2 Replies Latest reply on Jun 5, 2017 4:18 PM by telston

    If Then Statements


      I am trying to create a If Then Statement that would return a value from a Table Lookup if another Attribute equals a value but can't seem to figure out how to do that.


      For example:  If my 'Site Status' = "Active" then I want it to return the current date in the DataEndDate attribute.  If the 'Site Status' = "Inactive" I would like it to select the DataEndDate field in a table.  Is this possible?  'Site Status' is set to lookup the value in the same table. 


      Here is an example of my imported table that I am using.  I originally tried just having a table lookup for the Data End Date but if the site was active and the End Date said 'Current Data' PI AF would put 'No Data' since it is not in a DateTime format.

      Thanks for any help!!

        • Re: If Then Statements

          Is it possible to configure the DataEndDate string in the source table? If you pass PI Time abbreviations you can easily achieve what you are looking for.


          For example if I use T in place of Current Data then set up a Table Lookup Data reference with the following information then I get today at midnight. If you use * you'll get the current time. Would this work for you?


          SELECT DataEndDate FROM Test WHERE SiteID = '%Element%'



          If you cannot change the input in the table then we can probably work this out using an analysis, let me know if you would need help configuring that, it would not be as ideal as the above example in my opinion.

          4 of 4 people found this helpful