Rich S Posted May 14, 2011 Posted May 14, 2011 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
wonfuji Posted May 15, 2011 Posted May 15, 2011 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
wonfuji Posted May 15, 2011 Posted May 15, 2011 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. 1
wonfuji Posted May 15, 2011 Posted May 15, 2011 well "You (or rather I) aren't permitted to upload this kind of file". I can send it to you back-channel if you like.
wonfuji Posted May 15, 2011 Posted May 15, 2011 Ah, Grasshopper! Your file must be zipped... Test123.fp7.zip
Rich S Posted May 16, 2011 Author Posted May 16, 2011 Thanks! I'll give it a go at work in a few days; it looks promising!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now