on ‎2011 Dec 14 3:08 AM
I am converting the old PowerBuilder code to the latest version and having some problem with a datawindow code which uses Union function.
The old code makes union of 4 tables with 3 tables. The old code works fine but there is syntax error with the new code. The error is caused by the 0 and 'X' in the following example. Can someone tell me what should be the right syntax. Thanks.
retrieve=" PBSELECT( VERSION(400) TABLE(NAME=~"table1~" ) TABLE(NAME=~"table2~" ) TABLE(NAME=~"table3~" ) TABLE(NAME=~"table4~" ) COLUMN(NAME=~"table1.a~") COLUMN(NAME=~"table2.b~") COLUMN(NAME=~"table2.c~") COLUMN(NAME=~"table3.d~") COLUMN(NAME=~"table4.e~") UNION( PBSELECT( VERSION(400) TABLE(NAME=~"table1~" ) TABLE(NAME=~"table3~" ) TABLE(NAME=~"table4~" ) COLUMN(NAME=~"table1.a~") 0 'X' COLUMN(NAME=~"table3.d~") COLUMN(NAME=~"table4.e~") ) )
Request clarification before answering.
The syntax from 12.5 Build 2511 for a union of the PB Demo DB department table looks like:
retrieve="
PBSELECT( VERSION(400) TABLE(NAME=~"department~" ) COLUMN(NAME=~"department.dept_id~") COLUMN(NAME=~"department.dept_name~") COLUMN(NAME=~"department.dept_head_id~"))
UNION
PBSELECT( VERSION(400) TABLE(NAME=~"department~" ) COLUMN(NAME=~"department.dept_id~") COMPUTE(NAME=~"'X'~") COMPUTE(NAME=~"1~"))) " update="department" updatewhere=1 updatekeyinplace=no )
Notice that the 'X' and 1 column values are tagged with COMPUTE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Chris Keating Thanks, if it was an answer, I'd accept it. The problem was because of missing COMPUTE tag.
@Chris Keating Just a small question, what would be syntax if i want to write NULL. It won't accept COMPUTE(NAME=~"NULL~"). Would the NULL be exactly same as COMPUTE(NAME=~"0~")?
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.