Format Rule Expression

Hi.

I have an EnumList Column called [Treatment Type] in Create Works Order Table and I want to create a simple Format Rule with conditional expressions that displays each of the options differently. Every expression I try just returns Cannot Compare List and Text.

Any help would be great, thank you.

@MauriceWhelan
I don’t think you can format each item of an Enumlist separately, because AppSheet will treat it as a single concatenated string at the end. However, provided you build a small table for those [Treatment Type] values (not sure how many of them you have) and construct your Enumlist as REF type, if you apply a formatting rule for each of the item in that small table, the Enumlist will reflect those values. This is the quickest way I can think of.

May be @Steve and/or @Aleksi might propose a better solution.

Many thanks for this suggestion @LeventK.

You’re welcome @MauriceWhelan, my pleasure

Differently in what way?

This should be easy to correct. What is/are your expression(s)?

@Steve

I just want the text values to be different colours.The 3 options are CSP, ReDip, Standard.

I have tried SELECT(Create Works Order[Treatment Type],[Treatment Type]=“CSP”)
I also tried with IN() expression.

@MauriceWhelan
How is your Enumlist content is set up? Hardcoded, or are you using a SELECT(…) expression in Valid_if or Suggested_Values property?

@LeventK

At the moment they are hardcoded values.

@MauriceWhelan
Then the only chance is the way I have proposed. You cannot apply the format rule otherwise. Check if this is what you want:

@LeventK

Exactly what I am looking for. Thanks a million for that.

1 Like

You’re welcome @MauriceWhelan, my pleasure. Could you please mark my post as solution?

Hi @LeventK

Can I just check the steps that I have carried out with you?

  1. Created a table called Miscellaneous with Column [Treatment Type]
  2. Changed the Base Type of my [Treatment Type] EnumList column in my Create Works Order table to Ref type and selected Miscellaneous as Referenced Table.
  3. Created a format rule for [Treatment Type] option 1 in Miscellaneous Table and set conditional expression to [Treatment Type] = “CSP”

But when I look at that value in the drop down list it is unformatted.

Have I missed something in my set up?

Many thanks.

I don’t think format rules work within the drop downs. Only outside of them.

1 Like

@MauriceWhelan
Have you set the expression in Valid_if to get the ref values?

SELECT(
	RefTableName[KeyColumn],TRUE)
)

In my sample app it’s set like this:
image



2 Likes

Hi @LeventK

Thank you for that. My bad. My select function was slightly wrong. I was using [Treatment Type] column instead of [Record ID]. Made the change and it is working perfectly now.

Many thanks again.

2 Likes

You’re welcome…Glad to hear that you have resolved the issue