9 Replies Latest reply on Feb 25, 2020 3:46 PM by Mark Francome

    Job Action as per capture

    Shahabaz Hamza
      Share This:

      Hi,

       

      How can I configure the action as "set to ok" based on the value of the variable captured in the same job?

        • 1. Re: Job Action as per capture
          Haw Kor

          Shahabaz,

           

          How is your variable being captured in the job? If it's based off output, you can set a job to "ok" based off of a specific statement in the output.

           

          Best,

          Haw

          • 2. Re: Job Action as per capture
            Shahabaz Hamza

            Hi Haw,

             

            Thanks for your reply. I configured the  "Capture from job output" under the "Actions" tab to pass the value to the variable. Now I want to know how can I use this variable in the "specific statement output".

            • 3. Re: Job Action as per capture
              Mark Francome

              You can just create an On/Do direct from the output. In this example I manipulate conditions based on a string in the output (Percent: 100  status: Ended OK), but you can just replace the Do part to be "Set to OK" -

               

              ss98.png

               

              this will not impinge on your variable processing.

              • 4. Re: Job Action as per capture
                Shahabaz Hamza

                Thanks for your reply, Mark. In the same job, I have captured a character into a variable from a particular position in the output. If the character is "S" then the job is successful or else failed. This is what I am trying to achieve.

                • 5. Re: Job Action as per capture
                  Mark Francome

                  Is the "S" is always in the same position in the line? If so, then a $ or ? will represent any single character. For example -

                   

                  Processing finished with value as S and ok

                   

                  would be matched by Code =

                   

                  ????????????????????????????????????????S???????

                   

                  However I would think there's a strong chance that you could incorrectly match here, using this technique. Is there anything else (something longer and more certain) in the output that would change when the variable is set?

                   

                  You can also consider using the Post-Processing field to get something to echo out in these cases (which can then be used by the On/Do processing).

                  • 6. Re: Job Action as per capture
                    Haw Kor

                    Shahabaz Hamza what you are trying to accomplish can be done by setting the job to NotOK  and then adding a secondary step to look for your specific statement output and then setting the job to OK. Notice the order in which this is done.  The job will be initially set to Not OK, only if the specific statement is found in the output will the job be set to OK.

                     

                    Haw

                    1 of 1 people found this helpful
                    • 7. Re: Job Action as per capture
                      Shahabaz Hamza

                      Thanks for your reply Haw.

                       

                      The 1st character in the 3rd line determines whether my job is successfully executed or not. Also, this is the only character in the line. I am trying to configure On-Do Actions for this.

                      • 8. Re: Job Action as per capture
                        Haw Kor

                        Shahabaz,

                         

                        This is the test I've conducted. The on-do action won't let you specify which line and which character to capture but since you're saying there is only one character on that line and it starts with that character you can use the example below:

                        • 9. Re: Job Action as per capture
                          Mark Francome

                          Hi Shahabaz,

                           

                          Although this will work, you might well end up with a scenario where matching on the one letter gives you a false positive.

                           

                          Could you consider getting the original script to echo out something specific (that you can then match on) or run a small .bat/.cmd job in the post-exec field that echoes out something when this process hits the right condition.

                          1 of 1 people found this helpful