pass store variables from macro to Line Loop UF Respondida

Kevin Howe

I need a validation that triggers on a Sales Order line item quantity. It needs to  check for other rows with the validated item on the current sales order (same item, more than one row.) I've tried to create a validation that runs a macro to store my current itemcode and row into STORE variables.

I am trying to use these variables in a lineloop SQL condition: IF $[$38.1.0 = @STORE1 AND $[$38.110.0] <> @STORE2 (if the itemcode is the same but the row is different...)

It doesn't appear that I can use STORE variables in a SQL Condition. I get a sql syntax error, which tells me the @STORE1 variable is not being processed prior to the add-on sending the SQL statement to the sql client. Can you confirm whether or not I can use STORE variables in this way? If not, can you make any suggestions as to my problem?

I'm trying to check for the same item on a sales order in a different row whenever an item is added or quantity updated. This needs to trigger on the row, not transaction update or add.

Comentarios

4 comentarios

  • Comment author
    Naama Aharoni
    • Comentario oficial

    Hi Kevin,

    You can try passing the Item Code to a UDF field and then you will have access to that value in the line loop.

    Thanks, Naama

  • Comment author
    Scott McClure

    Is it simply not possible to use @STORE values in SQL() statements in a UF?  You didn't answer his question.  I'm trying to find a way to use the results of one SQL statement as a parameter for the WHERE clause in another SQL statement.  Is this only possible through screen fields?

    0
  • Comment author
    Scott McClure

    Kevin,

    I've been working with (and asking for documentation on) the @STORE quite a bit.  First, they do persist from UF to UF and even from screen to screen.

    Second, it seems that in the SQL statements they need to be in single quotes and put within some kind of SQL function.  For instance, using @STORE1 as an argument in a WHERE clause I find that WHERE Field = @STORE1 fails with and error as does WHERE Field = '@STORE1' but WHERE  Field = LTRIM('@STORE1') works.  There might be more elegant ways  to make it work but these can be used as variables.

    Sure would love to see some of this clarified and documented in a Guide - understanding the Stores system kind of doc!

    Thanks,

    Scott

     

    0
  • Comment author
    Yaremi Miranda Lopez

    Hello Kevin,

    Yes you can, here is the link to a guide that can help you use @STORE statements and conditions like IF and CASE:

    https://support.boyum-it.com/hc/en-us/articles/204284198-Guide-Understanding-Macro-Conditional-Commands

     

    0

Iniciar sesión para dejar un comentario.