Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Okay, I'm stuck. I want to prevent users from inserting formatted text (boldface, italics, color, etc.) into my solution so I thought of using the calculation, TextFormatRemove(Self), on all the user-available fields using the AutoEnter Calculation function...but to do that for all the fields--100+ of them--seems like a klunky way of doing things. Is there a more elegant solution to accomplish the same goal?

As always, TIA for your help!

Rich

Posted

Hi

If you are open to scripting this script will tidy up all fields on a layout.

Some notes on it.

1. It was made to tidy data in a legacy system where repeating fields rule.

2. I did not ever get it to work for portals

3. You will note it requires no context to run in. Completely portable(but doesn't do portals)

4. The routine can be run via script trigger - On RecordCommit or OnLayoutExit

5. Error Capture On deals with calculated fields - you don't get the warnings.

#Systems - Remove Formatting By Indirection

Set Error Capture [ On ]

#Capture all field names on this layout

#Count the number of fields

#Capture layout table name

#

Set Variable [ $AllFields; Value:FieldNames ( Get ( FileName ) ; Get ( LayoutName ) ) ]

Set Variable [ $FieldCount; Value:ValueCount($AllFields) ]

Set Variable [ $ThisTable; Value:Get ( LayoutTableName ) ]

Set Variable [ $Count; Value:1 ]

Loop

Exit Loop If [ $Count > $FieldCount ]

Set Variable [ $Counter; Value:1 ]

Loop

#Store the field name

#If it is a repeating field note the number of reps - a non-repeater will return Horizontal 1 or Vertical 1.

Set Variable [ $ThisField; Value:$ThisTable & "::" & GetValue($AllFields; $Count) ]

Set Variable [ $Reps; Value:FieldRepetitions ( Get ( FileName ) ; Get ( LayoutName ) ; $ThisField ) ]

#The returned value is text and number, we just want the number...

Set Variable [ $RepsCount; Value:GetAsNumber($Reps) ]

#

#Capture the value in the current field.

Set Variable [ $FieldValue; Value:GetField($ThisField & "[" & $Counter & "]") ]

#Define the target and strip formatting from the value

Set Variable [ $Target; Value:$ThisField & "[" & $Counter & "]" ]

Set Field By Name [ $Target; TextFormatRemove($FieldValue) ]

Set Variable [ $Counter; Value:1 + $Counter ]

Exit Loop If [ $Counter > $RepsCount ]

End Loop

#

Set Variable [ $Count; Value:1 + $Count ]

Set Variable [ $RepsCount; Value:"" ]

Set Variable [ $Reps; Value:"" ]

End Loop

Stephen

Posted

If that works for you and you ever figure out how to be indirect with portals I'd love to see how you did it. My goal was complete portability.

See attached file.

  • Like 1
Posted

Thanks! I'll give it a go at work in a few days; it looks promising!

This topic is 4998 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.