Could someone explain this error to me, pleas...

expressions
(Michael) #1

Could someone explain this error to me, please? All referenced fields are base type text. Attempting to use this expression in a workflow…

Error msg: IFS function is used incorrectly:Inputs to IFS() must be condition-value pairs. Input 6 is not a value of a consistent type.

Expression: IFS([StructureID].[Insulator_Type]=“Porcelain”,[PorcelainCondition], [StructureID].[Insulator_Type]=“Polymer”,[PolymerCondition], [StructureID].[Insulator_Type]=“PolymerAndPorcelain”,“Replace All Insulators”)

(Michael) #2

@Levent_KULACOGLU Levent, thank you for the very through explanation however, it doesn’t quite answer the question. Following either if your solutions, the user is presented with a list of options to choose from although, the user will only be able to choose ONE option and not multiple.

For example:

=IFS( CONTAINS([StructureID].[Material],“Wood”),WoodCondition[WoodCondition], CONTAINS([StructureID].[Material],“Steel”),SteelCondition[SteelCondition], CONTAINS([StructureID].[Material],“Concrete”),ConcreteCondition[Concrete] )

If the structure material is Steel, the user should only choose one option pertaining to it’s condition such as ‘Grade 1’.

However, if the structure material is Wood, the user should be able to choose multiple options that pertain to the condition such as Wood Rot AND Cracking.

How can I enable selection if multiple options from the referenced list?

(Michael) #3

@Levent_KULACOGLU That is an approach I (obviously) never thought of.

Following your method of specifying TEXT type, the user is only able to choose one option. Is there a similar method that would allow multiple options to be choposen like ENUMLIST?

(Levent KULAÇOĞLU) #4

Try with:

CONCATENATE(“Replace All Insulators”)

at the end.

(Levent KULAÇOĞLU) #5

IFS( [StructureID].[Insulator_Type]=“Porcelain”,[PorcelainCondition], [StructureID].[Insulator_Type]=“Polymer”,[PolymerCondition], [StructureID].[Insulator_Type]=“PolymerAndPorcelain”, CONCATENATE (“Replace All Insulators”) )

(Michael) #6

@Levent_KULACOGLU Perfect… Sorry I missed that earlier. Quick question semi-related to this issue if you have time:

I have several fields that are setup as Enums with valid_if references to other tables. I do this because depending on what is chosen in another field, I want the list of options to be different. So if user enters X in [THIS_FIELD] I want the emum list of options to be X_Options. If Y is chosen, the list of options to be Y_Options.

Unfortunately this often fails with the error that the chosen option cannot be converted to enum type. Any idea why that is or what I can do to workaround this?

(Levent KULAÇOĞLU) #7

@Michael

Provided you define a dropdown value with constructing an expression in Valid_if like TableName[ColumnName], you don’t need to explicitly set the column’s type as ENUM. It will be better if you set them as TEXT and construct an IFS statement in Valid_if property like:

IFS( Condition1, TableName[ColumnA], Condition2, TableName[ColumnB], Condition3, TableName[ColumnC] )

(Levent KULAÇOĞLU) #8

@Michael

ENUM and ENUMLIST are way different. If you want to have multiple selection, then you have to explicitly choose the column type as ENUMLIST but can assign its values with Valid_if expression for sure.

(Levent KULAÇOĞLU) #9

@Michael

With ENUMLIST, your IFS statement condition should be set either by IN or CONTAINS expression provided you want to create a conditional content i.e.

IFS( IN(“SomeText”,[EnumlistColumnName]),TableName[ColumnA], . . )

OR

IFS( CONTAINS([EnumlistColumnName],“SomeText”),TableName[ColumnA], . . )

The bare difference between IN and CONTAINS is, IN looks for exact text inside a list, where CONTAINS looks for similar text

For example; think of a list of values like: {“apple” , “banana” , “kiwi”} in [FRUITS] column

IN(“apple”, [FRUITS]) returns TRUE; where CONTAINS([FRUITS],“app”) OR CONTAINS([FRUITS],“apple”) also returns TRUE; however IN(“app”,[FRUITS]) will return FALSE

(Levent KULAÇOĞLU) #10

@Michael as your base column type will be an ENUMLIST, you cannot change that column type dynamically as per a dependent selection or selected value.

(Levent KULAÇOĞLU) #11

But of course you can set 2 columns one for an ENUM and one for an ENUMLIST and then show/hide them as per selected value

(Michael) #12

@Levent_KULACOGLU Thank you Levent but the response is the same:

(Levent KULAÇOĞLU) #13

@Michael

StructureID, Insulation_Type, Polymer Condition, Porcelain Condition are all type of Text? Can you check and verify pls.? And pls check if the column that you’re constructing this expression is also Text

(Michael) #14

@Levent_KULACOGLU Yes, I triple checked. StructureID is a reference to a text type field, The others are Enums with base types of text.

(Levent KULAÇOĞLU) #15

@Michael try with this:

IFS( TEXT([StructureID].[Insulator_Type])=“Porcelain”,[PorcelainCondition], TEXT([StructureID].[Insulator_Type])=“Polymer”,[PolymerCondition], TEXT([StructureID].[Insulator_Type])=“PolymerAndPorcelain”, CONCATENATE (“Replace All Insulators”) )

(Michael) #16

@Levent_KULACOGLU Same result…

(Levent KULAÇOĞLU) #17

@Michael can you share your app with levent@able3ventures.com with co-author status so that I can check? And also please point me the table name, column to look at and which column you are trying to construct this expression. It’s hard to guess without seeing. Thnx.

(Michael) #18

@Levent_KULACOGLU I have added you to the app as a co-arthor. The expression would be used in a workflow so it isn’t written in the table. But, it the field for which I need the value is in table Inspection.

In short, this table is for inspection of Structures. In the Structures table, the user states what type of insulators in installed, Polymer, Porcelain, or PolymerAndPorcelain. When inspecting the structure, the inspector must evaluate the condition of the insulator. Depending on whether the insulator is Polymer or Porcelain, this insulator condition is stored in the corresponding field.

If the insulator installed (Structures table) is PolymerAndPorcelain, we do not record a condition or the insulator and simply want the workflow report to state “Replace All Insulators”.

(Levent KULAÇOĞLU) #19

@Michael the reason why your expression giving an error is because your [Porcelain Condition] and [Polymer Condition] columns types are ENUMLIST. ENUMLIST column types always produce a LIST. Therefore your expression shall be:

IFS( [StructureID].[Insulator_Type]=“Porcelain”,LIST([PorcelainCondition]), [StructureID].[Insulator_Type]=“Polymer”,LIST([PolymerCondition]), [StructureID].[Insulator_Type]=“PolymerAndPorcelain”,{“Replace All Insulators”} )