I am creating a conditional formatting for each new month (numeric column) using the Dynamic or Unknown Fields in the Table tool.
([Limit_Min_Max]='max' &&
[_CurrentField_]>=[Limit_Number]*0.9 &&
[_CurrentField_]<=[Limit_Number])
OR
([Limit_Min_Max]='min' and
[_CurrentField_]<=[Limit_Number]*0.9 &&
[_CurrentField_]>=[Limit_Number])
I'm getting the following error:
Invalid type in operator >.
When I added the function ToNumber([_CurrentField_]), I found out that it is pointing to a different column that is a string datatype ([Warehouse]).
How can I make sure that the [_CurrentField_] is actually pointing to the actual current field?
Solved! Go to Solution.
@Arvinchester
I did a simple test on my end and it seems just working.
I am sorry to ask but are you sure that the field is numeric? The error indicates your field type is not numeric.
And one more, I think your conditional Statement should be as below.
([Limit_Min_Max]='max' &&
[_CurrentField_]>=[Limit_Number]*0.9 &&
[_CurrentField_]<=[Limit_Number])OR
([Limit_Min_Max]='min' and (
[_CurrentField_]<=[Limit_Number]*0.9 or
[_CurrentField_]>=[Limit_Number]))
I've attached the select tool. The values of the _CurrentField_ is coming from the [Warehouse] column.
For example, [Oct-2023] is the new column and inherits the formula from 'Dynamic or Unknown Fields', then it will throw that error.
If I replace the [_CurrentField_] with [Oct-2023] in the formula, then it will not throw an error.
Thanks for correcting the formula as it will not result correctly. Here is the modified formula.
([Limit_Min_Max]='max' &&
[_CurrentField_]>=[Limit_Number]*0.9 &&
[_CurrentField_]<=[Limit_Number])
OR
([Limit_Min_Max]='min' &&
[_CurrentField_]<=[Limit_Number]*1.1 &&
[_CurrentField_]>=[Limit_Number])
Is the data type correct for > or < comparisons? If it's not numeric in nature then you need to change it.
@Arvinchester
I can now identify what is causing the error, but can not know the logic.
So whatever comes from upstream of data, we can not deselect any column otherwise, it will throw an error.
In your workflow, SheetName was deselected, so it had error.
After I select the Sheeet Name column, then it was just ok.
Maybe a bug?
Thank you Qiu. Indeed, the [_CurrentField_] is quite sensitive when there are columns that are deselected in the Table tool, especially if they are at the top of the list. I removed the [SheetName] from the previous select and then moved [Limit_Number] and [Limit_Min_Max] to the end of the list. I deselected both columns and had no problems. I tried adding one more 'deselected' column and [_CurrentField_] went off again so I removed it.
@Arvinchester
Thank you for the feedback.
I still can not figure out what is the logic behind. 😁