1. Michał Misijuk
  2. PowerBuilder
  3. Thursday, 29 October 2020 19:06 PM UTC


I have a DW, where in one of the column is string, with editmask ####.00

When I'm setting a value in DW like 1234.56, insert into database lookis like '123456' , and i would like to looks like 1234.56. 
I've tried GetItemFormattedString, and something hardcoded like string(dw.getitemstring,'####.00') but nothing works.

Is this even possible to get value with mask?

Oracle 12c, PB 2017 R3 build 1858

Michał Misijuk Accepted Answer Pending Moderation
  1. Friday, 30 October 2020 07:43 AM UTC
  2. PowerBuilder
  3. # 1

Hi Chris.

What I want to acomplish, is filed where i can put, number, or 0 , or null. This is no problem when number is without coma, like 1234, or 55. Field is string, editmask with ####. Problem begins when coma appears. 

I've tried Your way - I've put this code in ItemChanged event, but when update is generating - this value is still without period.

PS I've put a MsgBox to show what value data contains after
data = string(data,'####.00') and it's this -> ####.00

  1. Chris Pollach @Appeon
  2. Friday, 30 October 2020 18:45 PM UTC
Chris Pollach @Appeon

Hi Michael ... Modified suggestion ....

IF String (DWO.Name) = "DecColumn" THEN

IF POS (Data, ".", 1) = 0 THEN

THIS.Post ue_set data ( DWO.Name , Data)


// In ue_set_data .(Args as_name and as_data) ...

IF Lower(as_name) = "deccolumn" THEN

IF POS (as_data, ".", 1) = 0 THEN

String ls_data

ls_data = String ( as_data, "#.00") // OR you could sub-string it ;-)

THIS.SetItem ( ls_name, ls_data )


Food for thought. HTH

Regards ... Chris
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 29 October 2020 19:35 PM UTC
  2. PowerBuilder
  3. # 2

Hi Michael;

   If the column type is "String" then the value would be "123456". If you change the column to be a decimal (7,2) - for example. Then the DWO would be sending a "1234.56" to the DBMS.

   If you still want the DWO's string (Char/Varchar) column to have the decimal formatting, then you would have to code that in the ItemChanged event. For example:

IF  String (DWO.Name) = "DecColumn"  THEN
    IF  POS (Data, ".", 1) =  0 THEN
        Data = String ( Data, "#.00")
    END IF

Regards ... Chris

There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.