lpm Posted June 4, 2007 Posted June 4, 2007 FMP8 Adv, WinXP In FMP5.5 I used this script successfully to move the cursor to the next line in a text field (list of items). Set Field ["ItemField", "ItemField & """] This worked great in FMP5.5. Then with a subsequent SetField, I could enter another value and it is placed properly on the next line under the first value and the cursor moves to the next line, etc, etc. In FMP8 I need to do the same thing (i.e. move the cursor to the next line in order to be in position to accept the next value) but the same script isn't working. Set Field [TableName::ItemField; TableName::ItemField & ] This returns the cursor to the next line OK, but the problem is when I do another SetField to enter the next value on the next line, the first value is overwritten instead. When I enter another value, that value is overwritten... and so on... What am I doing wrong? TIA lpm
AudioFreak Posted June 4, 2007 Posted June 4, 2007 In Layout mode check Field Behavior and make sure the target field is not set to Select Entire Contents on Field Entry. HTH
Vaughan Posted June 4, 2007 Posted June 4, 2007 So what is the calculation in the second Set Field? I'm kinda not sure what you're saying here. Set Field *always* replaces the entire contents of the field. The function in the first Set Field calculation "ItemField & """ replaces the entire field contents with the entire contents *plus* a new paragraph at the bottom. The field behaviour shouldn't make any difference. The second Set Field should be something like "ItemField & "" & ".
comment Posted June 5, 2007 Posted June 5, 2007 The field behaviour shouldn't make any difference. It will, if the cursor is in the field when the script runs. I am not sure what the purpose is here. Set Field[] is not a good choice for controlling cursor location. If the field needs to be prepared for user entry, Set Selection[] would be much better. Creating a fresh new record would probably be even better.
lpm Posted June 5, 2007 Author Posted June 5, 2007 I checked and it is not set to "select entire contents...". I've played with this script for more than two hours now and I can't understand why in FMP5.5 the script works and why in FMP8 it does not. It still overwrites the text rather than moving to the next line. The field is not used anywhere else in the remainder of the script. I've tried a "commit record" step after the Set Field and that does not work either. Still confused! TIA
comment Posted June 5, 2007 Posted June 5, 2007 Try: Set Field [ yourfield ; yourfield & ¶] Go to Field [ yourfield ] I believe that should work in all versions.
lpm Posted June 5, 2007 Author Posted June 5, 2007 Sorry for the confusion I have caused. This is the exact script in FMP5.5 that I want to replicate in FMP8: Set Field ["CodesEntered", "CodesEntered & """ CodesEntered is a field name. The script (in 5.5) sets the value (of the code) in the field and then moves to the next line and waits for the next time the script is run at which time a new value (code) is placed on the line beneath the previous value and the cursor is again placed on the next line, etc.
comment Posted June 5, 2007 Posted June 5, 2007 I am afraid we are not communicating here. What is the purpose? If it waits for another script, who cares where the cursor is? Actually, it would be better if the cursor would NOT be in the field, so that no one can accidentally type over your data. The next script can place the value after the current content, using another Set Field[] step - just as the first script placed a carriage return there. I don't even know why you need the first script: why not let the second script set the field to: the field & ¶ & new value, all at once?
lpm Posted June 5, 2007 Author Posted June 5, 2007 Here's the exact way it looks in FM8: Set Field[Teachers::CodesEntered; $CopyCodeNum] Set Field[Teachers::CodesEntered; Teachers::CodesEntered & ""] ....something's missing in this script I think.
LaRetta Posted June 5, 2007 Posted June 5, 2007 Set Field[Teachers::CodesEnte red; [color:red]$CopyCodeNum] Set Field[Teachers::CodesEnte red; Teachers::CodesEntered & ""] You can't START a script with a script variable unless a line prior is Set Variable[] or you've passed a script variable from another script via script parameter. What is wrong with your second step above? Set Field[[color:blue]Teachers::CodesEnte red; [color:green]Teachers::CodesEntered & ""] The green should be the SAME FIELD as the blue field - the one being set. Then only that one step will be required. Why are you trying to use a variable in your process? You still haven't explained the purpose yet. LaRetta
lpm Posted June 5, 2007 Author Posted June 5, 2007 I hope this helps to explain the purpose of the CodesEntered field process I'm trying to understand. Here's what I have... Set Variable [$CopyCodeNum; Value:Objectives::CodeNum] Set Field [Teachers::CodesEntered; $CopyCodeNum] Set Field [Teachers::CodesEntered; Teachers::CodesEntered & ""] The CodesEntered field (with scroll bar) should log the codes that have been entered by the user when they select a button in a portal row. The user does not access the CodesEntered field directly, the code is set when the user selects the portal row button. There usually are no more than 10-20 codes that need to be logged, but i need them to display in a vertical list within the CodesEntered text field. That is why I need the cursor to move to the next field and be ready for the next code to be entered. The user needs to see the codes that they have entered while they scroll through the portal selecting other portal row buttons. TIA
Genx Posted June 5, 2007 Posted June 5, 2007 Then just use: Set Field [Teachers::CodesEntered; Teachers::CodesEntered & "" & Objectives::CodeNum]
LaRetta Posted June 5, 2007 Posted June 5, 2007 Or, to eliminate the blank line at the beginning (when the field is empty at first), use: Teachers::CodesEntered & Objectives::CodeNum & ¶ You can strip the possible carriage return from either beginning or end if you wish. Usually having the return at the beginning can bug your Users but having it at the end isn't a real problem. L
lpm Posted June 5, 2007 Author Posted June 5, 2007 Thank you Genx and LaRetta (& everyone else!)! That worked Great! Thank you so much! lpm
Recommended Posts
This topic is 6383 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 accountSign in
Already have an account? Sign in here.
Sign In Now