double quotes in column name - can't assign column to a variable

Sort:
You are not authorized to post a reply.
Author
Messages
Steve11
Basic Member
Posts: 11
Basic Member
    I'm using a query in the SQL Query node and the query references a column called UNION. Well, UNION is a keyword in Oracle (no, I didn't create the table, it's Lawson table) so I have to put double quotes around the name for a valid query. The query works fine but the problem is trying to access the "UNION" variable in the query (jobGradeQuery_"UNION"). The Assign node does not like those double quotes. When I try to assign the UNION string to a variable I get an error basically stating that the expression is invalid.

    Here's the query:

    SELECT ACTIVE, "UNION", SALARYSTRUCTUREGRADE, PAYGRADE FROM LTM.POSITION WHERE HRORGANIZATION = '500'

    Here's the assign statement:

    foobar = jobGradeQuery_"UNION"

    Is there a way to get around this?

    thanks,
    Steve
    Jimmy Chiu
    Veteran Member
    Posts: 641
    Veteran Member
      SELECT ACTIVE, '"UNION"'. SALARYSTRUCT..............
      Steve11
      Basic Member
      Posts: 11
      Basic Member
        I'm already doing that. The problem is trying to assign the data in the "UNION" column to a variable in a processFlow assign node.

        Because of the quotes in "UNION" you get a sysax error when trying to assign the column data to a variable.

        e.g.

        foobar is a varible of type string-

        jobGradeQuery is tghe query node name.

        the following assignment (done in an assign node) generates a systax error:

        foobar = jobGradeQuery_"UNION"

        David Williams
        Veteran Member
        Posts: 1127
        Veteran Member
          I was wondering since the field variable name is actually jobGradeQuery_UNION and not just UNION if the quote was really needed? If so then does it make sense that the quotes should go around the whole variable name and not just the end: "jobGradeQuery_UNION" ?
          David Williams
          David Williams
          Veteran Member
          Posts: 1127
          Veteran Member
            If you're getting an error on an Assign node, leave the quotes out completely.
            David Williams
            Steve11
            Basic Member
            Posts: 11
            Basic Member
              The field variable name is jobGradeQuery_"UNION". The double quotes are part of the variable name! It can't be changed as it was generated by processFlow. Other field names don't have quotes, as there are no quotes used for those columns in the select clause.

              e.g.,

              SELECT ACTIVE, "UNION", SALARYSTRUCTUREGRADE, PAYGRADE FROM LTM.POSITION WHERE HRORGANIZATION = '500'

              results in variable names of:

              jobGradeQuery_"UNION"
              jobGradeQuery_ACTIVE
              jobGradeQuery_PAYGRADE

              etc.


              Maybe I could edit the processFlow xml file and try to change the jobGradeQuery_"UNION" variable name?


              --Steve




              Mark McGee
              Posts: 3
                I had a similar issue which I resolved by using an alias in the sql query:

                SELECT ACTIVE, "UNION" as myunion, SALARYSTRUCTUREGRADE, PAYGRADE FROM LTM.POSITION WHERE HRORGANIZATION = '500'

                Then the variable would be:

                jobGradeQuery_MYUNION
                Steve11
                Basic Member
                Posts: 11
                Basic Member
                  Unfortunately the variable becomes

                  jobGradeQuery_"UNION" as myunion

                  that's even more of a mess!

                  I also tried

                  SELECT ACTIVE, "UNION" "myunion", SALARYSTRUCTUREGRADE, PAYGRADE FROM LTM.POSITION WHERE HRORGANIZATION = '500'

                  which produces a variable of

                  jobGradeQuery_"UNION" "myunion"

                  thanks,
                  Steve
                  Mark McGee
                  Posts: 3
                    Can you reference "union" as r_union instead?
                    Steve11
                    Basic Member
                    Posts: 11
                    Basic Member
                      sorry, I don't follow you. Do you mean changing the query, or?
                      Mark McGee
                      Posts: 3
                        In S3, when the column name in dbdef is an oracle reserved word, the column name inside oracle is preceded by r_.
                        I am not sure if that is the case with LTM, if so, you could change the sql from select "union" to select r_union.

                        If that is not the case I am fairly sure that you can use the column number in the variable instead of the name:
                        jobquery_2 (if this is the second column returned).
                        Steve11
                        Basic Member
                        Posts: 11
                        Basic Member
                          ah! I'm new to Oracle...

                          I tried your suggestion and LTM doesn't recognize the r_. I get an "invalid identifier" error.

                          Nor can I use jobquery_2, it's not recognized as a variable...


                          thanks,
                          Steve
                          John Henley
                          Posts: 3351
                            Have you tried escaping the double quote character, e.g. "=
                            Thanks for using the LawsonGuru.com forums!
                            John
                            Steve11
                            Basic Member
                            Posts: 11
                            Basic Member
                              I tried escaping the processFlow variable name when I made the assignment:

                              foobar = jobGradeQuery_\"UNION\"

                              and

                              foobar = jobGradeQuery_'"UNION"'

                              and

                              foobar = jobGradeQuery_""UNION""

                              none of the above works. Is that what you had in mind?

                              thanks,
                              Steve
                              KK - Infor
                              Veteran Member
                              Posts: 61
                              Veteran Member
                                Steve,
                                Try to assign in the free form JavaScript area in the Assign node.(using the 'Add JavaScript' button).
                                And then, after the JS Expression, in the same assign node, put - foobar = foobar (using the usual Lawson Assign way). This way you'll be able to see the value in the WU logs.

                                Hope this helps!

                                Cheers,
                                KK
                                Steve11
                                Basic Member
                                Posts: 11
                                Basic Member
                                  KK,

                                  Adding

                                  foobar = jobGradeQuery_LTM.POSITION."UNION"

                                  in the javscript tab of the assign node results in the error msg:

                                  Error while validating expression: foobar = jobGradeQuery_LTM.POSITION."UNION" missing name after . operator.

                                  If Iuse another query variable that doesn't have the double quotes it works fine.

                                  thanks,
                                  Steve
                                  ailsally
                                  New Member
                                  Posts: 2
                                  New Member
                                    Steve,
                                    You may already have a solution to this issue since this posting is a couple of years old. Anyway, I found that you can use \ as the escape character for the double quote. For example: "\"" + UNION + "\"" will give you the result as "UNION".
                                    Shari
                                    Veteran Member
                                    Posts: 78
                                    Veteran Member
                                      I will be out of the office Thursday, June 21 through Wednesday, July 4, 2012. If you need immediate assistance, please contact the Service Desk at (215) 542-0730 (support@support.actslife.org). Otherwise I will return your message when I am back in the office. Thank you!

                                      -Shari

                                      >>> <forums-bpm-pflow@lawsonguru.com> 06/21/12 12:00 >>>

                                      Lawson ProcessFlow Forum Notification
                                      ----------------------------------------------------------------
                                      Posted by:ailsally
                                      Date: 06/21/2012 09:48 AM
                                      Subject: RE: double quotes in column name - can't assign column to a variable
                                      Message:
                                      ----------------------------------------------------------------
                                      Steve,
                                      You may already have a solution to this issue since this posting is a couple of years old. Anyway, I found that you can use \ as the escape character for the double quote. For example: "\"" + UNION + "\"" will give you the result as "UNION".
                                      ----------------------------------------------------------------
                                      To view the complete thread and reply via your browser, please visit:
                                      https://www.lawsonguru.co...olumn-to-a-variable/

                                      Thank you,
                                      LawsonGuru.com

                                      You were sent this email because you opted to receive email notifications when someone posted and/or responded to a message on this forum. To unsubscribe to this thread please visit your user profile page and change your subscription options.
                                      You are not authorized to post a reply.