display numeric values with comma(,) on offline form

Please do not use to report errors- use your regional help desk.
Please mark posts as being for RPG or RDMLX (LANSA) developer.
To subscribe by email, display this forum, scroll to the end and select ‘Subscribe Forum’.
Post Reply
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

display numeric values with comma(,) on offline form

Post by MegumiSawada »

Is it possible to display numeric values with comma(,) on offline form?

On Online form it can show the numeric values with comma(,) when using Set_Label.

e.g.
Define Field(#FLDN070) Type(*dec) Length(7) Decimals(0) Edit_Code(1)
#COM_OWNER.Set_Label Name(FLDN070) Layout_Row(5) Layout_Col(2) Text(#FLDN070.AsDisplayString)

On Offline form,is it possible to do so?(either for Label/Textbox)
If so, could you please let me know how?

e.g.
#Com_Owner.Set_Label Layout_Row(5) Layout_Col(2) Name(TB_SALARY)
#Com_Owner.Set_Binding Name(TB_SALARY) Property(VALUE) Bindtotype(FLD) Bindto('Salary')

I appreciate your kind advice.

Best Regards,
Megumi Sawada
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

Re: display numeric values with comma(,) on offline form

Post by MegumiSawada »

I think I found a solution for this. I need to write javascript to do this.

Assume there're a text box named "TB_EMPNO" and a label named "LB_Salary" on the form.

Code: Select all

lrexec( 
              function() 
               { 
              this.q_getProperty("Form.Fields.TB_EMPNO.Value");
                }, 
              function(value1) 
               { 
                 this.EMPNO = value1;
                 this.q_sendVars("EMPNO");
               }, 
              function() 
               { 
                 this.q_sql('SELECT Salary FROM Employee WHERE Empno = ?EMPNO','scalar');  
               }, 
               function(value2) 
               { 
               var myTextBox1 = value2;
                 var num = new String(myTextBox1).replace(/,/g, "");
                 while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
                 var myResult = num; 
                 this.q_setProperty("Form.Fields.LB_SALARY.Text", myResult ); 
               }, 
               null 
             );
The value of LB_SALARY will be formatted with comma.
I don't know it is a smart way.

Megumi
tsupartono
Posts: 289
Joined: Wed Apr 18, 2012 10:21 am

Re: display numeric values with comma(,) on offline form

Post by tsupartono »

Hi Megumi,
We'll add the ability to specify thousand separator (in NumberTextFormat) in the next release.
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

Re: display numeric values with comma(,) on offline form

Post by MegumiSawada »

Hi Tony,

Thank you for that.

Regards,
Megumi
Post Reply