Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Calculation to find a word if it is on a line by itself in a list


This topic is 3903 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi folks. I am having an issue creating a script. where part of it finds a word within a list (in a field).

 

The word I am looking for is "Salary". However the list may contain lines that say one or more of "Salary", "Salary Increases" and "Salary Decreases". And I want to find if there is a line with just the word "Salary" in it. The patterncount function isn't doing the job as it will count (correctly) any of the three lines if they exist. Also, the order of the lines may change in each record so I can't tell the calculation to look on a particular line of the list. Is there a way to find just the word "Salary", ignoring the other two possibilities without actually scripting a Find?

 

James

Posted

You speak of a calculation, a script and a find, all at once - as if they were the same thing. What is the actual goal here? And while I am at it: why do you even have a field with multiple values?

Posted

Update: Figured out a solution but it seems a little convoluted! Below is basically what I did. In reality this is part of a much larger Let function

If (
Patterncount ( List_Field ; "Salary" ) = 3 and Patterncount ( List_Field ; "Salary Increases" ) = 1 and Patterncount ( List_Field ; "Salary Decreases" ) = 1 
or
Patterncount ( List_Field ; "Salary" ) = 2 and Patterncount ( List_Field ; "Salary Increases" ) = 1 and Patterncount ( List_Field ; "Salary Decreases" ) = "" 
or
Patterncount ( List_Field ; "Salary" ) = 2 and Patterncount ( List_Field ; "Salary Increases" ) = "" and Patterncount ( List_Field ; "Salary Decreases" ) = 1 
or
Patterncount ( List_Field ; "Salary" ) = 1 and Patterncount ( List_Field ; "Salary Increases" ) = "" and Patterncount ( List_Field ; "Salary Decreases" ) = ""
; "True" )

Can anyone think of a better way to do this, out of interest?

Posted

Lol, sorry for the confusion Comment. It is a Set Field script step, with a calculation in it. The bigger picture is that there are a number of fields that can be updated in a table. If any of these fields are updated it runs a script that creates a list of the updated fields. This list is then used as part of a print layout to show the user what has been updated.

 

This section looks in the list that has been created thus far to find if the Salary field has been updated already. If so, when the list is added to, the word "Salary" will appear in it.

 

The reason I am recreating the list each time a field is updated is so I can keep it in alphabetical order.

 

I hope that made a little more sense!

This topic is 3903 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.