Announcement

Collapse
No announcement yet.

Using Global variable on grid sql statement

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using Global variable on grid sql statement

    I have the following sql statement using the global variable [gvloc]
    SELECT
    ic.INVID,
    ic.ICPRTFormat,
    ic.ICVendorNum,
    ic.ICPartNum,
    inventory.PartNum,
    inventory.description,
    inventory.price1,
    inventory.avgcost,
    inventory.ptnum,
    inventory.subptnum,
    inventory.pcdesc,
    inventory.subpcdesc,
    qoh.qqoh,
    vendor.name
    FROM
    ic LEFT OUTER JOIN vendor ON ic.ICVendorNum = vendor.vendornum
    LEFT OUTER JOIN inventory ON ic.INVID = inventory.INVID
    LEFT OUTER JOIN qoh ON (ic.INVID = qoh.qINVID and qoh.qlocnum = [gvloc]) order by ic.icprtformat

    I get the following error
    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\NetMake\v7\wwwroot\scriptcase\app\rc_menu\ic _inq_grid\ic_inq_grid.php on line 503

    Any help will be appreciated....

  • #2
    Try putting quotes around the global variable
    I.E.
    '[gvloc]'

    Kevin

    Comment


    • #3
      I have same issue with SLADS, and I tried to put quotes around the global var, but it still does not works. Can anybody help ?

      Comment


      • #4
        Originally posted by Kdriscoll View Post
        Try putting quotes around the global variable
        I.E.
        '[gvloc]'

        Kevin
        Still get same results...

        Comment


        • #5
          I've just had a solution and it let my code run :
          In SQL Select Statement :
          SELECT
          ic.INVID,
          ic.ICPRTFormat,
          ic.ICVendorNum,
          ic.ICPartNum,
          inventory.PartNum,
          inventory.description,
          inventory.price1,
          inventory.avgcost,
          inventory.ptnum,
          inventory.subptnum,
          inventory.pcdesc,
          inventory.subpcdesc,
          my_view.qqoh
          vendor.name
          FROM
          ic LEFT OUTER JOIN vendor ON ic.ICVendorNum = vendor.vendornum
          LEFT OUTER JOIN inventory ON ic.INVID = inventory.INVID
          LEFT OUTER JOIN my_view ON ic.INVID = my_view.qINVID order by ic.icprtformat

          In SQL Preparation :

          CREATE OR REPLACE VIEW `my_view `
          AS
          (
          SELECT * FROM qoh WHERE qoh.qlocnum = [gvloc]
          )

          Comment


          • #6
            Originally posted by thuann89 View Post
            I've just had a solution and it let my code run :
            In SQL Select Statement :
            SELECT
            ic.INVID,
            ic.ICPRTFormat,
            ic.ICVendorNum,
            ic.ICPartNum,
            inventory.PartNum,
            inventory.description,
            inventory.price1,
            inventory.avgcost,
            inventory.ptnum,
            inventory.subptnum,
            inventory.pcdesc,
            inventory.subpcdesc,
            my_view.qqoh
            vendor.name
            FROM
            ic LEFT OUTER JOIN vendor ON ic.ICVendorNum = vendor.vendornum
            LEFT OUTER JOIN inventory ON ic.INVID = inventory.INVID
            LEFT OUTER JOIN my_view ON ic.INVID = my_view.qINVID order by ic.icprtformat

            In SQL Preparation :

            CREATE OR REPLACE VIEW `my_view `
            AS
            (
            SELECT * FROM qoh WHERE qoh.qlocnum = [gvloc]
            )
            I can't seem to get this to work...

            Comment


            • #7
              Hello,

              Please contact our support regarding this issue. Our chat is active on workdays from 8:00am to 6:00pm (GMT -3), and our ticket system is always available.

              regards,
              Bernhard Bernsmann

              Comment

              Working...
              X