IT Process Automation

  • 1.  Using the 'Select From Database' operator with the 'Display null values' option, what is the correct notation for checking the null values?

    Posted Dec 12, 2016 02:43 PM

    If the database field is 'date_stop_extended', to acess the data I use

          Process[OpName].QueryResults[0].date_stop_extended

     

    How can I check for a null value on that same field?

     

    Here's my example:

     

     

    Thanks for the help!!



  • 2.  Re: Using the 'Select From Database' operator with the 'Display null values' option, what is the correct notation for checking the null values?

    Posted Dec 12, 2016 06:27 PM

    Process[OpName].QueryResults[0].date_stop_extended.length == 0



  • 3.  Re: Using the 'Select From Database' operator with the 'Display null values' option, what is the correct notation for checking the null values?

    Posted Dec 14, 2016 08:18 AM

    Thanks for the help Lindsay!  When the date is null I am getting the current timestamp in the results so the length is never 0.  Do I need to do something different?



  • 4.  Re: Using the 'Select From Database' operator with the 'Display null values' option, what is the correct notation for checking the null values?
    Best Answer

    Broadcom Employee
    Posted Dec 14, 2016 09:53 AM

    It is by design that if a date is null, it writes the current date to the database.  You can override this behavior though. 

    If you select operator’s properties you would see a check box called “Display null values” like below.

     

    When it is checked it is going to generate another array of values named “NullFieldFlags”.

    From the PAM documentation

    NullFieldFlags

    An array of ValueMaps. The fields of each ValueMap correspond to the fields in rows. The value of each field is either true. The corresponding value in rows is null, or false otherwise. This output only displays if Display null values is selected.

    In Simple words:

    It is an array of valuemap filled with Booleans. A value of true means that corresponding value in the results no matter what is in the results, the value is null in the database. Like shown below that the date has the Boolean true while name has false. That means date field is null is the database.

     

     



  • 5.  Re: Using the 'Select From Database' operator with the 'Display null values' option, what is the correct notation for checking the null values?

    Posted Dec 14, 2016 11:04 AM

    I appreciate your help.  I do understand all of what you are saying.  I had 'NullFieldFlags' checked and I saw the 'true' value.  I guess I'm not wording my question correctly so let me try again! 

     

    When I want to check the value of the database field, I use this:

              Process[OpName].QueryResults[0].date_stop_extended

     

    I want to check first to see if this field is null, so how do I format the name for the null value in the NullFieldsFlags array?

    I figured it was something like this:

              Process[??].NullFieldFlags[0].date_stop_extended

     

    I'm thinking this is obvious to most people so please forgive my ignorance, but I cannot see how to do this!

     

    Thanks again!



  • 6.  Re: Using the 'Select From Database' operator with the 'Display null values' option, what is the correct notation for checking the null values?

    Broadcom Employee
    Posted Dec 14, 2016 12:50 PM

    My apologies.  I came at this from the middle instead of starting at the beginning.  :-)

     

    The syntax should look something like this:

    Process.Query_Database_1.QueryResults.ResultSets[0].NullFieldFlags[0].Ended

     

    A little trick in Process Automation, if you run the process and then find the value you are trying to reference in the dataset, right click on it and select "View Expression" to see the proper syntax for referring to that value in future runs of the process.



  • 7.  Re: Using the 'Select From Database' operator with the 'Display null values' option, what is the correct notation for checking the null values?

    Posted Dec 14, 2016 02:59 PM

    Hooray, it works!  Just what I was looking for!  I really appreciate that and thanks for revealing the trick on looking at the syntax.  That hint is incredibly helpful!

     

    Many thanks!