Custom number format from report variable

Stimulsoft Reports.JS discussion
Post Reply
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Custom number format from report variable

Post by mrapi »

Hi,in .NET version I could control the number format setting it to Custom and Format Mask= {myVariableFormat} then from the code I could set report variable myVariableFormat to desired values like #0.0000 or #0.00...

Code: Select all

     Dim wRp As New StiReport 
        wRp("myVariableFormat") = "#0.00" 
        ...
the same I've tried in Js version
....

Code: Select all

   report.loadFile('reports/myreport.mrt');
   report.dictionary.variables.getByName("myVariableFormat").valueObject = "#0.00";
but in preview instead of formated value I see the text: {myVariableFormat}
any clue?
thanks
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Custom number format from report variable

Post by Lech Kulikowski »

Hello,

Please send us your report for analysis.

Thank you.
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Custom number format from report variable

Post by mrapi »

Hi.
I've attached a sample report
Attachments
test.mrt
(4.79 KiB) Downloaded 167 times
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Custom number format from report variable

Post by Lech Kulikowski »

Hello,

Unfortunately, in the JS version, it is not possible to use the variable as the custom format.

Thank you.
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Custom number format from report variable

Post by mrapi »

Hi.it is possible to set the format from the code outside the report?
some like this:
report.GetComponent...Format=...
thanks
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Custom number format from report variable

Post by Lech Kulikowski »

Hello,

You can use the following code:

Code: Select all

var txt = report.getComponentByName('Text1');
txt.textFormat = new Stimulsoft.Report.Components.TextFormats.StiCustomFormatService("#.00");
Thank you.
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Custom number format from report variable

Post by mrapi »

it works.thanks
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Custom number format from report variable

Post by Lech Kulikowski »

Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.
Post Reply