Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 2136

Querymode issues when amending DDDW allowedit property

$
0
0

Hi,

 

I have a strange issue that I am unable to solve and wondered if anyone has any ideas.

 

My application uses generic querymode functionality in all data windows. In most data windows we have dddw objects that have allowedit set to No. When placing a datawindow into querymode we loop through each dddw field and set the allowedit property to Yes to enable it to be used for querying. When coming back out of querymode after the retrieve, we then set allowedit back to No.

 

Here is the generic code I use to place datawindows in and out of querymode:

 

STRING s_desc, s_colname, s_allowedit

LONG l_col, l_cnt

 

s_desc = dw_query.describe("datawindow.querymode")

CHOOSE CASE s_desc

  CASE "no","No"

    //set dddw columns to allowedit

    l_col = long(dw_query.describe("datawindow.column.count"))

    FOR l_cnt = 1 to l_col

      s_desc = "#" + string(l_cnt) + ".name"

      s_colname = dw_query.describe(s_desc)

      s_desc = dw_query.describe(s_colname + ".DDDW.Name")

      IF s_desc <> "?" THEN

        s_allowedit = dw_query.describe(s_colname + ".DDDW.AllowEdit")

        CHOOSE CASE s_allowedit

          CASE "no","No"

            dw_query.modify(s_colname + ".DDDW.AllowEdit=Yes")

        END CHOOSE

      END IF

    NEXT

    //put the datawindow into querymode

    dw_query.Modify("DataWindow.Table.Sort=''")

    dw_query.modify("datawindow.querysort=Yes")

  CASE "yes","Yes"

    //retreive based on user query

    dw_query.event ue_retrieve()

    //take the datawindow out of querymode

    dw_query.modify("datawindow.querymode=No")

    //set dddw columns back to allowedit = No

    l_col = long(dw_query.describe("datawindow.column.count"))

    FOR l_cnt = 1 to l_col

      s_desc = "#" + string(l_cnt) + ".name"

      s_colname = dw_query.describe(s_desc)

      s_desc = dw_query.describe(s_colname + ".DDDW.Name")

      IF s_desc <> "?" THEN

        s_allowedit = dw_query.describe(s_colname + ".DDDW.AllowEdit")

        CHOOSE CASE s_allowedit

          CASE "yes","Yes"

            dw_query.modify(s_colname + ".DDDW.AllowEdit=No")

        END CHOOSE

      END IF

    NEXT

END CHOOSE

 

The first time you run the retrieve like this it works ok, however, on any subsequent retrieves I get an incorrect syntax error - "Incorrect syntax near 'VERSION'"

 

Looking at the sqlpreview event, this seems to be caused by the select statement now being in PBSELECT format.

 

Sqlsyntax in sqlpreview is like this on first retrieve in querymode after changing DDDW allowedit property to Yes:

 

SELECT Bill_exasxcode.asxcode , Bill_exasxcode.appdate , Bill_exasxcode.closedate , Bill_exasxcode.instime , Bill_exasxcode.usrname , Bill_exasxcode.bexasxno , Bill_exasxcode.clsite FROM Bill_exasxcode WHERE (((Bill_exasxcode.asxcode = 'property')))

 

Then like this in subsequent retrieves after having amended the allowedit property back to No:

 

PBSELECT( VERSION(400) TABLE(NAME="Bill_exasxcode" ) COLUMN(NAME="Bill_exasxcode.asxcode") COLUMN(NAME="Bill_exasxcode.appdate") COLUMN(NAME="Bill_exasxcode.closedate") COLUMN(NAME="Bill_exasxcode.instime") COLUMN(NAME="Bill_exasxcode.usrname") COLUMN(NAME="Bill_exasxcode.bexasxno") COLUMN(NAME="Bill_exasxcode.clsite") EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" EXP2 = "(not sorted))" WHERE(EXP1 = "(((Bill_exasxcode.asxcode" OP = "=" EXP2 = "'property')))") )

 

If I remove the code to set allowedit back to No I don't get this issue.  So it seems that setting allowedit to Yes has no impact but setting back to No casues the problem.

 

Does anyone have any ideas? I this a PB bug, or am I missing something obvious?

 

To workaround it can I convert the PBSELECT syntax to standard sql syntax somehow?

 

FYI - I am using PB12.6 classic, connecting to SQL Server 2012 using SNC ODBC.

 

Thanks

Gordo


Viewing all articles
Browse latest Browse all 2136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>