Home > database >  PB modify data window select statement encountered problems
PB modify data window select statement encountered problems

Time:10-11

Dw_1. Reset ()
Ls_oldselect=dw_1. The describe (" datawindow. Table. Sqlselect ")

Is_selectwhere='
Uf_createtable ()
If is_selectwhere="' then
Dw_1. Settransobject (sqllis)
Dw_1. Retrieve (ld_ksrq ld_jsrq, ls_patientid, ls_patientname)
The else
Ls_newsetselect=ls_oldselect + is_selectwhere
Dw_1. Object. Datawindow. Table. Select=ls_newsetselect
Dw_1. Settransobject (sqllis)
Ll_i=dw_1. Retrieve (ld_ksrq ld_jsrq, ls_patientid, ls_patientname)
End the if
Dw_1. Object. Datawindow. Table. Select=ls_oldselect
When this code runs for the first time can get right to the data, but when the second run, unable to get data, is still the data for the first time, then through getsqlselect () found that the data window select statement is the first time assignment, by dw_1. The describe () to obtain a select statement is like the second assignment

CodePudding user response:

Dw_1. Object. Datawindow. Table. Select=ls_newsetselect

Instead of

Dw_1. Setsqlselect (ls_newsetselect)

Try again, if not, take a look at setsqlselect return value, if there is an error in your SQL

CodePudding user response:

If it is Oracle, is probably the lack of a semicolon at the end of the SQL statement

CodePudding user response:

This code is very chaotic, need to be input to the operation of the data window,

CodePudding user response:

The first code sequence should be as follows:
W_1. Reset ()//just empty the data
Ls_oldselect=dw_1. The describe (" datawindow. Table. Sqlselect ")//should be taken is not naked where clause for SQL syntax

Is_selectwhere='//no where clause
Uf_createtable ()//not clear purpose, the function after is_selectwhere values will not change, the if statement only perform the else forever behind the front half,
//this is the problem, the value of the local variable cannot because call uf_createtable changed ()
If is_selectwhere="' then
Dw_1. Settransobject (sqllis)
Dw_1. Retrieve (ld_ksrq ld_jsrq, ls_patientid, ls_patientname)
The else
Ls_newsetselect=ls_oldselect + is_selectwhere
Dw_1. Object. Datawindow. Table. Select=ls_newsetselect
Dw_1. Settransobject (sqllis)
Ll_i=dw_1. Retrieve (ld_ksrq ld_jsrq, ls_patientid, ls_patientname)
End the if
Dw_1. Object. Datawindow. Table. Select=ls_oldselect

CodePudding user response:

I don't know do what uf_createtable ()

CodePudding user response:

Personal advice, to form a good coding habits, in order to quickly locate and deal with the problem,

CodePudding user response:

So old posts are, apparently didn't come home after Posting the original poster

CodePudding user response:

All over the past year, old posts are left...

CodePudding user response:

This topic mainly lies in the


If pos (ls_oldselect, 'where') & gt; 0 then
Ls_selectwhere='and' + field matching and
The ELSE
Ls_selectwhere='where' + field matching and
End the if
Ls_newsetselect=ls_oldselect + is_selectwhere

CodePudding user response:

Ls_oldselect=dw_1. The describe (" datawindow. Table. Sqlselect ")
This sentence to
If ls_oldselect & lt;> 'the or not isnull (ls_oldselect) then ls_oldselect=dw_1. The describe (" datawindow. Table. Sqlselect ")
Note ls_oldselect statement from a local variable to instance variables can be

CodePudding user response:

The above change will again or change the and of the if
  • Related