Skip to main content
October 30, 2023
Question

Dynamic Tab expression rule

  • October 30, 2023
  • 10 replies
  • 0 views

So I am trying to have a dynamic page name depending on the number of tasks being displayed in grids. I have set up an if() statement for the page view name and I have the expression rule set up as:

a!queryProcessAnalytics(report: cons!report,
contextProcessModels: rule!ContextProcessModels(),
query: a!query(
                     pagingInfo: local!pagingInfo,
                     logicalExpression: a!queryLogicalExpression(
                                                         operator: "OR",
                                                          filters: {
                                                                     a!queryFilter(
                                                                                     field: "c8",
                                                                                     operator: "=",
                                                                                      value: ri!orderId,),},),),

).totalCount,
{local!Variable}))

orderId is a rule input and its a integer type, when the code is run, it will give the correct values but other times it gives a value that is too high. I tried doing length(union(local!Variable,{}) but I received an error saying "Invalid types, can only act on data of the same type (Number (Integer), Any Type)", union(local!variable, local!Variable) but that did nothing.

I'm pretty sure my error is in the last line of code I'm just not sure how to match it with an integer value or if there is something else that I am missing. Any help is appreciated! Thank you.

10 replies

stefanhelzle0001
Brainy
October 31, 2023

The things you explain and the code snippet do not really match. Can you share more of the code?

nickk1385Author
October 31, 2023

Apologies, maybe I was not clear but that is all the code.

I made this expression rule that calls the a!queryprocessAnalytics().totalCount,

then there is the list that runs the one singular local variable,

then the record's view page has an IF() statement that will display the text depending on the number given from the expression rule.

So in a perfect world, the expression rule provides the appropriate TotalCount based on the orderID, then the record will display the correct page name depending on what value the expression rule produces. At thye moment it is working for most of the records, but some of them seem to have a totalCount that is higher that what should be there.

The expression rule looks to the correct record, contectProcessModels and has the query parameter to look for the orderID rule input all looking to produce the totalCount. I had another user story identical to this but the type was a text so it allowed me to just do length(union(local!variable, {})) but since orderId is a integer I am receiving an error. The code I provided is essentially what is in Appian, I hope this helps or can clear up any confusion!

stefanhelzle0001
Brainy
October 31, 2023
I made this expression rule that calls the a!queryprocessAnalytics().totalCount,

OK, so this returns a single integer, correct?

then there is the list that runs the one singular local variable,

 ...... what !?!?!? .....

Then, what is that "length(union(local!variable, {}))" about?

In my perfect world, you need to split your issue into smaller pieces, solve each, and then reassemble it. If something does not behave as expected, create a separate test case and only continue if you either found and fixed the bug, or have an explanation for that behaviour.