AnsweredAssumed Answered

Using "Value Count" in a script

Question asked by LeoB on Mar 31, 2010
Latest reply on Mar 31, 2010 by LeoB

Title

Using "Value Count" in a script

Post

I have a field on a settings menu in which the user can insert up to three items which will become part of a Value List.  It works fine.

 

However, I am trying to limit the user to just three items.  I have a triggered script on field exit that I thought would work  that would use the Value Count function as that would count the number of lines on the script and would then display a Custom Dialog if the limit had been exceeded and then revert the field.

 

But, I cannot figure out how to set the Value Count string properly.  FMP Help shows an example of:

 

ValueCount (“Item 1¶Item 2¶Item 3”)

 

But does that mean that the term Item1, etc., must be entered in the script?  If so, it doesn't work.

 

I also tried entering in a number:  ValueCount ( 3 ).  That does not work.

 

I also tried it with wildcards:  ValueCount (“*¶*¶*”), but that does not work.

 

By not working, I mean that the script shows the value count exceeded no matter what is entered into the field.  I also presume this can be done by field validation, but I would prefer my own Custom Dialog to instruct the user of where to go for help.

 

The script is, roughly:

 

If [Admin::ValueList1Settings > ValueCount ( 3 )]

    Show Custom Dialog

    Revert Record/Request [No dialog]

End If

 

There are no posts on this forum that discuss the Value Count function, so I presume it's not used much.

 

Any ideas?

 

Thanks.

Outcomes