8 Replies Latest reply on Nov 26, 2019 5:51 AM by Gordon McKeown

    Arithmetic  in BAO

    MdAkram Shaikh
      Share This:

      Hi Folk

      I am trying to get the range of epoch seconds to select the records from a staging from via AO.

       

      I am getting the current time stamp from the utility of AO. but when I am trying to substract the epoch seconds the result is coming in exponential.

       

      Please suggest how to achieve this?

       

      example submit date=current timestamp -  epoch seconds

       

      the result is coming correct in preview but when we execute the process the value after calculation is coming zero

        • 1. Re: Arithmetic  in BAO
          Carl Wilson

          Hi,

          when you say staging form, do you mean in Remedy and you want to use a timestamp range on the Submit Date?

           

          The current timestamp (Java) value generated in TSO/AO has more accuracy than that as stored in Remedy, therefore you have to trim down the returned value to the same length of what is expected for Remedy (I think from memory you trim the last 3 digits).  You can then subtract the epoch seconds you want from this value in TSO/AO and use this to query the Submit Date.

          Alternately you can form the query yourself using Remedy keywords e.g. for Submit Date, pass in "$TIMESTAMP$ (or $\TIMESTAMP) - {epoch seconds}.

          If you can get the query to work in Remedy using a search, then this is what you can pass in via TSO/AO.

           

          Example: Records submitted in the past 24hrs

           

          • 'Submit Date' > $TIMESTAMP$ - (24 * (60*60))

           

          Cheers

          Carl

          • 2. Re: Arithmetic  in BAO
            MdAkram Shaikh

            Hi Carl,

            I am trying to subtract two epoch numbers numbers in xslt. but that i s not working correctly

            can you Please help me with that .

             

            in XSLT I am passing two Tokens and doing a subtraction there in value of token1 - token2

             

            when i test this in preview window it shows me correct result or exponantail value as result  but when i test it end to end process  it gives me zero value

             

            Regards,

            Akram

            • 3. Re: Arithmetic  in BAO
              Carl Wilson

              Hi,

              you can use the Utility Activity to perform the subtraction using 2 Context Items.

               

              https://docs.bmc.com/docs/TruesightOrchestration/81/numeric-utilities-807044101.html

               

              Cheers

              Carl

              • 4. Re: Arithmetic  in BAO
                MdAkram Shaikh

                ya I tried with this only but I am getting exponential result as the number are epoch if I use small number the result is coming correct .

                • 5. Re: Arithmetic  in BAO
                  MdAkram Shaikh

                  Thanks carl it is working fine. some other issue was there because of that the context item was getting overridden.

                  • 6. Re: Arithmetic  in BAO
                    Gordon McKeown

                    Let's say you've got these tokens:

                     

                    Performing the following:

                     

                    You get the result:

                     

                     

                    So change this to:

                     

                     

                    And you get:

                     

                     

                    Can't reproduce your issue with exponent results from the add utility. Inputs are:

                     

                    Utility configured like so:

                    Process output is:

                     

                     

                    Can you provide an example that demonstrates the problem?

                     

                    Edit: Never mind... just saw your comment indicating that the problem was due to over-written context  

                    • 7. Re: Arithmetic  in BAO
                      MdAkram Shaikh

                      Hi Gordon,

                      First option in which you use token works only when you test in the preview output  but when you run the process end to end it gives improper result. or zero value.

                      the second approach  utility  is giving the correct result to me.

                       

                      thanks for your response.

                      • 8. Re: Arithmetic  in BAO
                        Gordon McKeown

                        In the output I show in my reply, the "Calculated Date" context item was output from the XPath subtraction during a process execution. So it works here. Obviously you've now got a working approach, but if you want to understand the other issue, post your workflow and we should be able to determine why it wasn't working.