×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Modify Datawindow SQL

Modify Datawindow SQL

Modify Datawindow SQL

(OP)
Dear all,

I've tried to modify a datawindow sql with number array argument, it always return "Incorrect syntax near '('" . I've performed the next statement:

Long ll_cd2[]
String ls_sql, ls_ext
ls_sql = dw_1.describle('datawindow.table.select')
// this datawindows contains number array "slo_cd2[]" argument defined in the datawindow painter with syntax as follows:
// SELECT order_line.slo_cd2,
// order_line.slo_prc,
// order_line.slo_cur,
// FROM order_line,
// WHERE order_line.slo_cd2 in ( :slo_cd2 )
// dw_1.retrieve(ll_cd2)
// this statement works fine without modifying
ls_ext = ' and ' + ' order_line,slo_prc > ' + '"' + String(ddlb_1.text) + '"'
ls_sql = ls_sql + ls_ext
ls_sql = dw_1.modify('datawindow.table.select = "' + ls_sql + '"' )
dw_1.settransobject(sqlca)
dw_1.retrieve(ll_cd2)
// the new sql appears like:
// SELECT order_line.slo_cd2,
// order_line.slo_prc,
// order_line.slo_cur,
// FROM order_line,
// WHERE order_line.slo_cd2 in ( :slo_cd2 )
// AND order_line.slo_prc > 100
// returns incorrect syntax near '(' line 5

// how to modify a datawindow with array arguments

Thank you...

RE: Modify Datawindow SQL

Not sure but in your examples you have
// FROM order_line,
// WHERE

which should be
// FROM order_line
// WHERE


Matt

"Nature forges everything on the anvil of time"
www.anvil-of-time.com

RE: Modify Datawindow SQL

(OP)
Dear Matt,

The problem is to include arrays argument inside the sql statement after modify:

Long ll_cd2[]
String ls_sql, ls_ext
ls_sql = dw_1.describle('datawindow.table.select')
// this datawindows contains number array "slo_cd2[]" argument defined in the datawindow painter with syntax as follows:
// SELECT order_line.slo_cd2,
// order_line.slo_prc,
// order_line.slo_cur
// FROM order_line
// WHERE order_line.slo_cd2 in ( :slo_cd2 )
// dw_1.retrieve(ll_cd2)
// this statement works fine without modifying
ls_ext = ' and ' + ' order_line,slo_prc > ' + '"' + String(ddlb_1.text) + '"'
ls_sql = ls_sql + ls_ext
ls_sql = dw_1.modify('datawindow.table.select = "' + ls_sql + '"' )
dw_1.settransobject(sqlca)
dw_1.retrieve(ll_cd2)
// the new sql appears like:
// SELECT order_line.slo_cd2,
// order_line.slo_prc,
// order_line.slo_cur
// FROM order_line
// WHERE order_line.slo_cd2 in ( :slo_cd2 )
// AND order_line.slo_prc > 100
// returns incorrect syntax near '(' line 5

// how to modify a datawindow with array arguments

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close