Just as Thad suggested which is better than what I did earlier..

Calculate the string length first, then replace all semi colons with null, take 
the second string length, and then calculate the difference.. The difference is 
the number of values, and since you terminate the string with a semicolon, you 
do not need to add 1..

Cheers

Joe

From: [email protected] 
Sent: Friday, June 03, 2011 2:21 PM
Newsgroups: public.remedy.arsystem.general
To: [email protected] 
Subject: Re: Workflow

** 

None of the strings have consecutive semicolons with no value in between them.
The workflow is setup that when a user selects a menu value, workflow inserts 
the menu value + a semicolon after each entry.

I apologize - but I am totally lost.  How would I count the semicolons in the 
field so that I know how many entries I have?

In this case if the field has:  IT Services; Accounting; Facilities;
I want to be able to set zTmp field = 3.



In a message dated 6/3/2011 2:15:39 P.M. Eastern Daylight Time, 
[email protected] writes:
  ** 

  Then its even more simpler if every string is terminated with a semicolon.. 
it’s the number of semicolons in the string.. You’ll just have to make sure 
there none of the strings have consecutive semicolons with no value in between 
them..

  Clean the logic that inserts the semicolons while adding or removing values 
from the string to ensure no consecutive semi colons in case you find some 
instead of having logic to consider that while counting the number of values..

  Joe

  From: [email protected] 
  Sent: Friday, June 03, 2011 2:10 PM
  Newsgroups: public.remedy.arsystem.general
  To: [email protected] 
  Subject: Re: Workflow

  ** 

  I put the semicolon in the wrong spot.
  It is actually
  IT Services; Accounting; Facilities;

  (the semicolon is on the end)


  In a message dated 6/3/2011 2:00:04 P.M. Eastern Daylight Time, 
[email protected] writes:
    ** 

    Unless I have not understood what you want right, I think this is fairly 
simple..

    If there is no semi colon after the last value, count the number of semi 
colons in the string, by running a loop on the string while looking for the 
semicolon using something like strstr() and then add 1 to get the number of 
values separated by semicolons...

    If there are some strings that end with a semi colon, then add some sub 
logic to see what the final character in the string is...

    Cheers

    Joe

    From: [email protected] 
    Sent: Friday, June 03, 2011 1:42 PM
    Newsgroups: public.remedy.arsystem.general
    To: [email protected] 
    Subject: Workflow

    ** 
    Hi,

    I want to count the multiple values within 1 field that are separated by a 
semicolon ;

    For example:
    The Dept field contains -----  IT Services; Accounting; Facilities
    I want to set another field with the value of 3.

    I am not sure what command I can use to count the semicolons.
    _attend WWRUG11 www.wwrug.com ARSlist: "Where the Answers Are"_
  _attend WWRUG11 www.wwrug.com ARSlist: "Where the Answers Are"_
  _attend WWRUG11 www.wwrug.com ARSlist: "Where the Answers Are"_
_attend WWRUG11 www.wwrug.com ARSlist: "Where the Answers Are"_

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug11 www.wwrug.com ARSList: "Where the Answers Are"

Reply via email to