Question 1
I have a Field "WorkType", which is a Text Field with "Auto-List of values", and it has this equation:
AME:[ItemColor]=iif([WorkType]="Call","blue"," ")
When I select "Call" in the drop-down list for the WorkType, the ItemColor turns blue.
However, instead of using a Text Field with "Auto-List of values", I would like to use Tags instead.
Is that possible? Is there some way to monitor a change in a Tag values so that the ItemColor turns blue when the "Call" Tag is selected?
----------
Question 2
One indirect way is to change the item instead, and use these Equations for the Item:
AM:#Call=iif (instr([Item],"Call")>0,-1,0)
AM:[ItemColor]=iif (instr([Item],"Call")>0,"blue"," ")
When I create an Item "Call Pierre" I expected it to check the "Call" Tag and change the ItemColor to Blue.
The first Equation works, the Tag "Call" is checked. However the second Equation fails; the ItemColor does not turn blue. What is wrong with the second Equation?
Comments
From 3. Tags, at the very…
From 3. Tags, at the very end, is a comparison of fields and tags:
w.r.t. Question 2, it should work, though adding multiple auto-assign rules to the item field is not the best ideain the long run
1. I am aware of the Tag Con…
1. I am aware of the Tag Con:
That is why I was hoping that there was a work-around. I think that the only "work-around" may be to keep the WorkType Field and have an Auto-assign rule that checks the Tags when the WorkType Filed is changed.
2. The Equation:
AM:[ItemColor]=iif (instr([Item],"Call")>0,"blue"," ")
also doesn't work when it is by itself. I can't figure out why not.
3. Instead of stacking Auto-assign rules, is it maybe better to create a function with the two assignments?
An equation cannot have two…
An equation cannot have two assignments. Basic math: y=f(a,b,c)
Any idea why AM:[ItemColor]…
Any idea why
AM:[ItemColor]=iif (instr([Item],"Call")>0,"blue"," ")
Doesn't work?
If Blue is a defined named…
If Blue is a defined named color, then the most likely cause is that VBScript Instr function is case-sensitive by default and you entered something different from "Call" See this page on how to use string insensitive functions: 7. Visual Basic Editor
Also, it is best to set the ItemColor to "" or to Null when Call is not found
Thanks Pierre! It doesn't…
Thanks Pierre!
It doesn't matter if I use blue or Blue; "" or " ".
I didn't realize that the Instr function was case sensitive because this auto-assignment:
AM:#Call=iif (instr([Item],"Call")>0,-1,0)
works if the item text contains either "Call" or "call".
However, with this auto-assignment:
AM:[ItemColor]=iif (instr([Item],"Call")>0,"Blue","")
only "Call" works but not "call"!
Why is it case sensitive in one case, but not the other?
The manual suggested how to make it case insensitive:
I don't understand how to use vbTextCompare, but with LCase it now works regardless if I use "call" or Call" in the item text :-):
AM:[ItemColor]=iif (instr(LCase([Item]),"call")>0,"Blue","")