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.

How do I loop a Clear Search Highlight where ParentID has multiple ChildIDs?

Featured Replies

Hi,

I have this script:

------------

If [ $$RecordClean [Child::ChildID] ]

Revert Record/Request [With dialog: Off ]

Set Variable [ $$RecordClean [Child::ChildID] ; Value: "" ]

Else

Set Field [Child::Value ; TextStyleRemove(Child::Value; If(Get(SystemPlatform) = 3; Bold; HighlightYellow) ) ]

End If

Exit Script [ Text Result: ]

------------

It's working correctly on the text field (Child::Value) of the first ChildID, but the search term stays selected from a previous search on the text field (Child::Value) of the remaining ChildIDs. TextStyleRemove should loop using the ParentID to perform the TextStyleRemove on ChildID 1, ChildID 2, etc. 

I hope this makes sense. Many thanks beforehand,

Daniel

32 minutes ago, Quito said:

I hope this makes sense.

I am afraid not.

  • We don't know what your script is meant to accomplish;
  • We don't know from what context it is called;
  • You say it should loop (over child records??), but there is no Loop clause.

I am guessing you are on the parent record, trying to modify a child field. As you have noticed, a reference to a field in a related table is interpreted as reference to the field in the first related record. This is true for calculations (unless you are using an aggregate function) as well as for the Set Field step. If you want to modify all child records, you will have to create a found set of them and loop over it. Or do the same thing in a portal.

But before all that: there is a big red light flashing in your title. It looks like you are modifying a searched field so that the search term becomes highlighted (and after that you want to remove the highlights). This is not good practice, for two reasons:

  1. In a multi-user scenario, two users searching for different terms will clash with each other. And any user editing a record will prevent the highlight being turned on or off for another user performing the search;
  2. It will render your LastModified fields completely useless.

If you want to highlight the search term, use an unstored calculation field. And that should also solve the current problem (assuming I guessed correctly). All you would have to do is refresh the window.

 

 

  • Author
1 hour ago, comment said:

I am afraid not.

  • We don't know what your script is meant to accomplish;
  • We don't know from what context it is called;
  • You say it should loop (over child records??), but there is no Loop clause.

I am guessing you are on the parent record, trying to modify a child field. As you have noticed, a reference to a field in a related table is interpreted as reference to the field in the first related record. This is true for calculations (unless you are using an aggregate function) as well as for the Set Field step. If you want to modify all child records, you will have to create a found set of them and loop over it. Or do the same thing in a portal.

But before all that: there is a big red light flashing in your title. It looks like you are modifying a searched field so that the search term becomes highlighted (and after that you want to remove the highlights). This is not good practice, for two reasons:

  1. In a multi-user scenario, two users searching for different terms will clash with each other. And any user editing a record will prevent the highlight being turned on or off for another user performing the search;
  2. It will render your LastModified fields completely useless.

If you want to highlight the search term, use an unstored calculation field. And that should also solve the current problem (assuming I guessed correctly). All you would have to do is refresh the window.

 

 

Thank you, Comment,

You guessed correctly. I'll follow your advice and try the unstored calculation field first. Can you provide an extra hint on how to accomplish this?

Best regards,

Daniel

Again, I don't know enough about your situation to make an intelligent suggestion. I suppose you want to use the same formula you used to add the highlight to the searched field. At its simplest, it could be something like:

Substitute ( YourField ; $$searchTerm ; TextStyleAdd ( $$searchTerm ; HighlightYellow ) )

But this may not be good enough because:

  1. Substitute() is case-sensitive;
  2. You may want to narrow the highlight to whole words.

Both of these are solvable, but require more work.

 

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.