Multiple If criteria

I am sure this has a simple answer that is eluding me, but…

Since, Compose does not support if statements (yet), I made separate Compose columns in my DocInventory table, depending on the Type of document. But using If and/or Filter not working to display them. If I select a document with the SelectList, I just want to display the appropriate Compose column, but the filter and If don’t work. If the document number equals the select list choice and the document type is Email, I want to display the EmailCompose column. Cannot even get it to print "EmalL or “Not Email”. This formula: Filter(DocInventory.FileNumber=SLCitesDisplay) && IF(DocInventory.Type.Contains(“Email”),“Email”,“Not Email”) does not work. Tried multiple formulas for quite a while. Documentation does not show how to use multiple filters or multiple criteria in an if statement. Here’s a link:

Thanks for you help.

Hey Doug!
I took a look at your formula, and what I might try here is this:

  • first part of this formula is filtering the table down to match the canvas control select list, then giving us the Type value from the filtered result. Then when we tack on contains() it’s evaluating whether or not the filtered result contains “Email”

  • second and third parts are either displaying “Email” or “Not Email” based on the truthiness of the above statement.

If you evaluate just the first part of this formula, you can see that this results in true, so you get Email as the result above:

Hope that helps, and thanks so much for the feedback on our formula documentation. I’ll be sure to share that with the team :+1:

Thanks very much!

With the help of Support and Christiaan Huizer, I finally got a formula that worked, using named formulas for the Type test and then using SwitchIf(). Once I knew it could find the Type (Email, etc), then I had to display the related Compose column:

EmailDocTypeTest =“Email”,DocInventory.Filter(FileNumber.Matches(SLCitesDisplay)).EmailCompose,
DocumentDocTypeTest = “Document”,DocInventory.Filter(FileNumber.Matches(SLCitesDisplay)).DocumentCompose,
InvoiceDocTypeTest= “Invoice”,DocInventory.Filter(FileNumber.Matches(SLCitesDisplay)).DocumentCompose,
“Mystery Document Type”)

What intrigues me is that “=” may not work. Support used Matches() and you used Contains(). Are we back to the “olden days” when “=” only works for numbers but Match or Contains is needed for a textual comparison operator?

Thanks again!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.