Page 1 of 1

display numeric values with comma(,) on offline form

Posted: Tue Feb 04, 2014 7:07 pm
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

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

Posted: Mon Feb 10, 2014 4:49 pm
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

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

Posted: Tue Feb 11, 2014 6:43 am
by tsupartono
Hi Megumi,
We'll add the ability to specify thousand separator (in NumberTextFormat) in the next release.

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

Posted: Wed Feb 12, 2014 11:19 am
by MegumiSawada
Hi Tony,

Thank you for that.

Regards,
Megumi