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.

If certain characters exist in current field then do another script

Featured Replies

Hello

I am trying to find out how to change scripts to execute conditional on if a certain text exists in the current field.

 

so

If the current field contains the word "list" then perform script A

but

If the current field does not contain the word "list" then perform script B

 

NOt sure how to do this

I just need a script like this that will check for the existence of a word in the current field and if the above conditions are met to perform the appropriate script.

Thank you

Try

 

 

Set Variable($wordlist ; Substitute(YourField; " "; "¶")

Set Variable($wordcount; ValueCount(FilterValues("list"; $wordlist))

# using $wordcount as a boolean (0 or blank is false, anything else is true)

If[$wordcount]

Perform Script ["Script A"] 

Else

Perform Script["Script B"]

End If

If the current field contains the word "list" then perform script A

 

You could probably use the PatternCount() function here. Unless you really mean a word as a word - which would make it more complicated - see: http://www.briandunning.com/cf/1390

 

 

It's also not quite clear what you mean by "current field". If it's the active field (one that contains the cursor), then try something like:

PatternCount ( Get ( ActiveFieldContents ) ; "list" )

as the test to determine which script to perform.

  • Author

I tried both 

I need to give you an exact example

 

I have URLS which are videos from youtube

I have a problem because some links are with a playlist and some are not

So 

I have to Leave the ones with the word "list" included in the URL alone --- Nothing needs to be changed (perform Script A)

But if the word "list" IS included then ----perform script  B

 

here are the two example urls

 

#---

The following text:

https://www.youtube.com/watch?v=onRKOcsf1J0&list=PL64500D4CD7B835A4

does NOT contain the word "list". It does, however, contain the pattern "list" and that's why you need to use PatternCount(0 function.

 

Note that the the longer the pattern, the less chances there are for a false positive - so you'd probably want to use "&list=" as the searchString parameter.

 

 

 

I tried both 

...

So I am not sure what I am doing wrong

 

Well, you didn't a say how you tried, and what were your results...

This seems like an additional need to one of your earlier post(s) on the web viewer, or open URL, etc.

 

If this should have been posted to one of them and not a new topic.

 

Let me know which topic you want me to merge this with.

The example you presented makes me think you're not conceptualizing it quite right. One button can only do one script -- are we talking about clicking a button? -- so you'll either have to have a Script C that branches to Script A or Script B, or just have a single script that handles both scenarios. A single script should be fine.

 

Also, as an alternative to PatternCount:

If[ Position( yourURLfield ; "&list=" ; 1 ; 1 ) ] 
  // do the Script A steps here
Else
  // do nothing? Script B steps here
End If

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.