Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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

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?

  • Author

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?

  • Author

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!

You should check out the FilterValues() function...

 

(and perhaps the new Get(ModifiedFields) function too).

I hope that made a little more sense!

 

Hope springs eternal, but no.

  • Author

Thank you Wim, that solved it. Comment, I am sometimes amazed I understand what is going on my head some of the time!

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.