3 Replies Latest reply on Feb 6, 2015 7:27 PM by Arti Rajagopalan

    Looping in AF Analytics

    Arti Rajagopalan

      Hi,

       

        I am working on an AF analytics calculation that calculates quality code of the target tag by determining the worst of tag quality of two source tags. Descending order of tag quality code : ""(null),A,W,E,I,S,>,<

       

      In my calculation , I have two data quality tags to compare against the list above and the worst of the two will be assigned to target tag. I'm not sure how to implement this in AF analytics since we do not have looping available (correct me if I am wrong).

       

      Any help is appreciated.

       

      Thanks,

      Arti

        • Re: Looping in AF Analytics
          Asle Frantzen

          Hi

           

          Instead of looping you'd probably have to utilize If-Else functionality.

           

          Use several expressions, and assign priorities to each quality code in the correct order.

           

          Name your first expression "FirstTag" and do: If(Tag1="") Then 1 Else If(Tag1="A") Then 2 etc.

          Do the same for "SecondTag".

          In the third expression you can compare the priorities of "FirstTag" and "SecondTag" to determine which should be used, and then output the correct value.

          • Re: Looping in AF Analytics
            bshang

            Another way to is create an AF Table with the quality codes and priorities. Then, create a Table Lookup DR for each tag quality Attribute and compare the Table Lookup attribute values in the AF analyses.

            • Re: Looping in AF Analytics
              Arti Rajagopalan

              Thank you Asle and Barry for your responses. I found a simple way to accomplish this by using built-in "InStr" string function. I used this function to assign priorities to each DQ tag:

               

              DQ1 :

               

              If 'tag1|qualityCode'="" then 100 else InStr("<>?SIEWA", String('tag1|qualityCode'))

               

               

              I compared the DQ priorities and the lowest value of the two was chosen as final DQ.

               

              Arti