1. Neil Garcia
  2. PowerBuilder
  3. Wednesday, 20 February 2019 16:34 PM UTC

Hi All,

 

I'm using PB12.1. I create a datawindow using syntaxfromsql and then add some controls dynamically into it. All is working except that when I want to modify the width expression of one the controls I added, I could not get any success. Can you spot what's wrong with the below modify statement?

 

I'm getting incorrect syntax error. 

string ls_mod
ls_mod = 'column1.width="1000~tLong(Describe(~"column2.x~"))+ Long(Describe(~"column2.width~")) - Long(Describe(~"column1.x~"))"'
dw_1.Modify(ls_mod)

Please note that when I apply that expression in a not dynamically created datawindow, it works fine. Is there anything else I need to do for a dynamically created one?

 

Thanks you

Neil

Neil Garcia Accepted Answer Pending Moderation
  1. Wednesday, 20 February 2019 19:22 PM UTC
  2. PowerBuilder
  3. # 1

Thank you All. I have figured it. Just have to double the tilde.

This one works now.

string ls_mod
ls_mod = 'column1.width="1000~tLong(Describe(~~"column2.x~~"))+ Long(Describe(~~"column2.width~~")) - Long(Describe(~~"column1.x~~"))"'
dw_1.Modify(ls_mod)

Thanks a lot. Appreciate your replies.

 

Regards,

Neil

Comment
There are no comments made yet.
Matthew Balent Accepted Answer Pending Moderation
  1. Wednesday, 20 February 2019 17:31 PM UTC
  2. PowerBuilder
  3. # 2

Something to try when troubleshooting this would be to first attempt the modify with a set value, something like:

'column1.width="1000~t500" 

Then continue by adding individual values from the various describe methods you use.  Perhaps this may lead you to the specific piece which is causing the issue

Comment
  1. Neil Garcia
  2. Wednesday, 20 February 2019 17:55 PM UTC
Thanks Matt. I've already tried your suggestion and it is working fine with the set value. It seems to be the describe that it is not able to understand. If I apply that expression in designer (with a non-dynamic dw), it accepts it.
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Wednesday, 20 February 2019 17:20 PM UTC
  2. PowerBuilder
  3. # 3

change:

dw_1.Modify(ls_mod)

to

ls_rval = dw_1.Modify(ls_mod)

to see if ls_rval has an error in it.

 

what kind of datawindow is it? (grid, form, ...)

Comment
There are no comments made yet.
Brad Mettee Accepted Answer Pending Moderation
  1. Wednesday, 20 February 2019 16:59 PM UTC
  2. PowerBuilder
  3. # 4

Is the name of the new control actually "column1" ?

You can clipboard your DW syntax, and paste into notepad, to make sure the new objects are named properly.

Comment
  1. Neil Garcia
  2. Wednesday, 20 February 2019 17:12 PM UTC
Hi Brad,



Thank you for the reply. Yes, I supplied the control name when I created it dynamically.



Regards,

Neil
  1. Helpful
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.