Submitted by viking on 2022/01/20 21:30

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 end, is a comparison of fields and tags:

Tags and Y/N fields are indeed quite similar

Tags Pros are:

  • Quicker to create, search, sort, view count
  • Integrated in Live-Search
  • Support Inheritance and multiple parents
  • Shown as a single column in grids
  • Specific branch of the tag hierarchy can be shown in a grid column

Y/N fields Pros are:

  • Support Equations and Auto-assigns
  • Conditional Formats
  • Visible to other apps, such as Excel

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:

Does not Support Equations and Auto-assigns

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?

 

 

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 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:

All string functions are case sensitive by default. To do case insensitive comparisons, use (1) LCase/UCase or (2) set the function compare parameter to 1 (vbTextCompare)I

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","")

 

How do I ?