- Amulya Kashyap
- PowerServer
- Wednesday, 28 February 2024 10:22 AM UTC
Hi Team,
We are using Appeon Powerbuilder CloudPro Edition.
We are updating the SQL UPDATE query based on a condition in DW SQLPreview event. The UPDATE query submitted to DBMS is fetched from SQLSyntax of SQLPreview event and is then modified and set as the Syntax to DW.
Example code:
IF col_1.value <> 'EXAMPLE' THEN
ls_update_sql = sqlsyntax
ll_pos_start = POS(ls_update_sql, "col_1.Name")
IF ll_pos_start > 0 THEN
ll_pos_end =ll_pos_start + LEN("col_1.Name = ") + LEN(STRING(col_1.value))
ls_update_sql = LEFT(ls_update_sql, ll_pos_start - 1) + "col_1.Name = " + String('EXAMPLE') + RIGHT(ls_update_sql, LEN(ls_update_sql) - ll_pos_end + 1)
END IF
THIS.SetSQlPreview(ls_update_sql)
END IF
Since, SQLPreview(SQLSyntax) is not supported, please let us know the way to get the UPDATE statement submitted to DBMS.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.