1. John Vanleeuwe
  2. PowerBuilder
  3. Thursday, 6 July 2017 06:49 AM UTC

Hi guys,

Basic question but i don't see the solution :(

I have 3 computed fields on my datawindow 1 with text , 1 decimal with European number formatting (being 1.234,56  ###,###.00) and another computed text.

Concatenating these 3 will loose the formatting of the decimal computed field.

Example

compute_1 = 'Abcdef'

compute_2 = 1.234,56

compute_3 = 'defghij'

 

compute_4 = compute_1 + ' ' + compute_2 + ' ' + compute_3 gives me as result = 'Abdcdef 1234.56 defghij'

Due to the variable length of compute_1, i can't 'hardcode' the position of my column instead of using computed field.

 

How can I keep the formatting inside my concatenation please ?

What am i missing here ?

 

 

TIA

John

Accepted Answer
Dirk B. Accepted Answer Pending Moderation
  1. Thursday, 6 July 2017 12:16 PM UTC
  2. PowerBuilder
  3. # Permalink

You need to convert the decimal to string while concatenating:

compute_4 = compute_1 + ' ' + string(compute_2, '###,###,##0.00') + ' ' + compute_3 gives me as result = 'Abdcdef 1234.56 defghij'

Dirk

Comment
  1. Dirk B.
  2. Thursday, 6 July 2017 12:58 PM UTC
Sorry, forgot to cut of the rest of the line while copying from your text.



It should look like this:



compute_4 = compute_1 + ' ' + string(compute_2, '###,###,##0.00') + ' ' + compute_3

Result: 'Abcdef 1.234,56 defghij'



Dirk

  1. Helpful
  1. John Vanleeuwe
  2. Thursday, 6 July 2017 22:18 PM UTC
You have no idea how dumb i am feeling now :(  Thanks Dirk !



 

  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.