2 Replies Latest reply: Feb 24, 2010 5:59 PM by Elif Tutuk RSS

    functions inside set analysis

      Hi,

      Can I use functions inside set analysis, like so:

       

      sum({$<ReservationDate={getfieldSelections(OtherReservationDate)}>} Sales)


      Thanks!

        • functions inside set analysis
          John Witherspoon

          Yes, but the syntax is very ugly:

          sum({<ReservationDate={$(=chr(39) & replace(getfieldselections(OtherReservationDate),', ',chr(39) & ',' & chr(39)) & chr(39))}>} Sales)

          The getfieldselections() function returns a list of comma separated values. I don't think set analysis likes that format, though. I believe it wants them in quotes, which is where the replace() and all the chr(39) values come in.

          A much easier approach to at least try would be to use an IF. I suspect it would be slower, but it's hard to know without testing.

          sum(if(ReservationDate=OtherReservationDate,Sales))

          I haven't tested either. Might have bugs.

          • functions inside set analysis
            Elif Tutuk

            You can also compare 2 fields in set analysis. Thanks!

            sum({$<ReservationDate=OtherReservationDate}>} Sales)