I want to apply two different formats using function.
for (let i = 0; i < a.formats.length; i++) {
flexmonster.setFormat(a.formats[i]);
flexmonster.refresh();
}
I tried above function but not apply why ?
Also I tried following:
flexmonster.setFormat(a.formats[0]);
flexmonster.setFormat(a.formats[1]);
flexmonster.refresh();
but appllied only one format.
What to do for apply multiple format?
Hello, Boni!
Thank you for contacting us.
Kindly note that only one format can be applied to the specific measure. Also, when setFormat()
is called without measure
and aggregation
properties, it overrides the default number format.
Therefore, if you call setFormat()
several times, the last format will be used in both cases.
You can find more details about setFormat()
API call in our docs: https://www.flexmonster.com/api/setformat/.
Could you please provide us with more details about your use case, mainly what behavior you want to achieve by applying multiple number formats to the component? With this information, we'll be able to suggest you some workaround.
Looking forward to hearing from you.
Regards,
Solomiia
I want to store all customise report in my database except data and Provide All customise report as Option while user is opening that report where raw data coming from common table but with different where conditions. Now I can perfectly run its using get/setReport. Just Challenge is whenever user select different option report then it recalculate/Analysing data again which takes more time compare to runquery() function. So I replace setReport() by series of runQuery(),for loop of setFormat() and addCondition() then setOptions(). Everything running perfect at very fast. Only constrain is not applying all format options. So How may I resolve it?
Hello!
Thank you for your swift reply and for providing us with a detailed description of your use case.
We kindly suggest adding a name
property to each FormatObject, and looping through them with setFormat()
API call as you used to.
Then, to assign the number formatting to a specific measure, you will need to set it in the slice property of the runQuery()
API call as follows:
measures: [{
uniqueName: "Price",
aggregation: "sum",
format:"dollar"
},
...
]
Here is a JSFiddle example for visualization: https://jsfiddle.net/flexmonster/7vp6ohwn/.
Kindly note that refreshing the component once after all API calls would be enough. Also, the runQuery()
always refreshes the page by itself, so in the provided example, there is no need for explicit refreshing.
Hope you will find this answer helpful.
Feel free to ask if any further questions arise.
Regards,
Solomiia
Hello, Boni!
Hope you are having a great week.
Our team is wondering if you had a chance to try the suggested approach of applying multiple formats with setFormat()
API call.
Could you please let us know if it works for your case?
Looking forward to hearing from you.
Regards,
Solomiia
Hello, Boni!
Hope you are doing well.
Just checking in to ask if the suggested approach of applying multiple formats with setFormat()
was helpful.
Looking forward to your response.
Kind regards,
Solomiia