Automate

 View Only
  • 1.  Validation rules - Contains

    Posted 08-09-2024 02:30

    Hello,

    I try to apply a validation rule on a logfield using the function contains.

    I want a pop up message when the query find 0 result :

    "Log Winshuttle Studio 20.3SAP System: Client: SAP User - QE1:100:pleydierMode   -   Table; Script Name   -   Table_20240807_094224.QsqRecords extracted   -   0Date and Time   -   8/9/2024 6:21:17 AMExecution Time   -   0:00:01Run Reason   -   "

    And no message when the query find 1 result :

    "Log Winshuttle Studio 20.3SAP System: Client: SAP User - QE1:100:pleydierMode   -   Table; Script Name   -   Table_20240807_094224.QsqRecords extracted   -   1Date and Time   -   8/9/2024 6:17:07 AMExecution Time   -   0:00:01Run Reason   -  "

    With the rules:"Logfield contains "0" ", the pop message appear whatever the query result is. 

    I guess it's because I have a "0" in my log in any case, so I try to replace the "0" in my rule by :"0Date" but with this condition the pop never appear.

    How can I make this rule work ?

    Regard 

    Paul



    ------------------------------
    Paul Leydier
    MDM
    Markem-Imaje Industries
    ------------------------------


  • 2.  RE: Validation rules - Contains

    Employee
    Posted 08-09-2024 10:24
    Edited by Sigrid Kok 08-14-2024 09:47

    Hi Paul

    Updating my reply:

    For Excel - I believe the IF conditions work on the rows of data, not the log message, which is typically in a cell and row of your choosing, but above the data - sometimes in line with column headers.  So for example, let's say output starts on row 3, it will look at data in row 3 and beyond.

    Perhaps you can amend your IF condition to say IF column C (just picking a random one that should have data if you have results) is empty (or is not empty) then do something or don't do something.

    For Forms - I've used this formula

    number(normalizeSpace(substringBefore(substringAfter($form.getValue('/my:myFields/my:QueryDepAreas/my:QueryDepAreas_Output/my:LogField_QueryDepAreas'), 'Records extracted   -   '),'Date and Time   ')));

    The above may be overkill, but I wanted to show the number of rows as a number. I've used the substringAfter and substringBefore combination a bunch of times.  You can then take that number and check it and do as you wish in the solution.

    Best Regards,

    Sigrid



    ------------------------------
    Sigrid Kok
    Precisely Software Inc.
    ------------------------------



  • 3.  RE: Validation rules - Contains

    Employee
    Posted 08-12-2024 12:37

    Few quick ideas:

    1. In your rule, try single quotes, this is how string value checks usually work for me. Ex: '0Date' 

    2. You could also use the Record Count from the Query output to build your rule. 



    ------------------------------
    Jayasri Varyani
    SE
    Precisely Software Inc.
    ------------------------------



  • 4.  RE: Validation rules - Contains

    Posted 08-13-2024 02:50

    What you can also try, is using the F(x) button, put in the same as you have but end it (like the syntax checker will show) with semi colon.

    "0Date";

    I struggled with a similar issue, sometimes SAP returns "0\nDate and.."  Because there is a backslash in it, the contains statement needs an escape character.

    So that became "0\\nDate and.." (2 slashes)



    ------------------------------
    Ed Meiners
    Consultant
    Wessanen Nederland Holding BV
    Amsterdam
    ------------------------------