you can use the OnObjectEnter script trigger on your field B, and make a script that populates field B with data from field A ...
If ( IsEmpty(FieldB); FieldA & "/"; FieldB )
Thanks David, but will this allow me to add an additional number after the "/" when I am editing the contact fields.
I am using this in my guest contacts db, where I like to give each guest a number begining with 16/ (for the year 2016).
What I am trying to achieve is NOT to have to type "16/" each time, just the additional number!
So far I have done this:- If (Year="2015";"15/";If(Year="2016"; "16/";If(Year = "2017";"17/";""))) whichI think is similar to your suggestion, thanks, bu it is adding the second part of the field that I am struggling with!!
In your subject field, make it auto enter "16/" & Self. Be sure to uncheck "Do Not Replace...etc." Enter your data, tab out of the field, and it will read 16/1whatever you typed.
So far I have done this:- If (Year="2015";"15/";If(Year="2016"; "16/";If(Year = "2017";"17/";"")))
Allow me to suggest:
Right ( theYear ; 2 ) & "/"
Right ( Year ( Get ( CurrentDate ) ) ; 2 ) & "/"
I made my answer overly generic. Combining my answer with Erolst's ...
(this prevents overwriting existing data)
If ( Isempty ( FieldB ); Right ( Year ( FieldA ); 2 ) & "/"; FieldB )
If FieldA contains a date, 12/11/2016, then entering (tabbing) into an empty FieldB will populate it with 16/ and place the cursor placed after the slash.
Hi David, thanks for suggestion. I have wriiten the script as you suggest (I think!!) :-
IsEmpty ( Contacts::testfield ) ;Right ( Year ( Contacts::Arrival Date); 2 ) & "/" ;(Contacts::testfield)
But when trying to OK it, I get a message saying that an operator is wanted here and refers to this part:-
;Right ( Year ( Contacts::Arrival Date); 2 ) & "/" ;(Contacts::testfield)
Any thoughts please.
Not really read much of the rest of the post, but that last statement will fire the error you mention due to the fact its not encased in an If statement. If ( IsEmpty ( Contacts::testfield ) ;Right ( Year ( Contacts::Arrival Date); 2 ) & "/" ;(Contacts::testified) )
what Andy said.
Plus, just in case, you should probably be using the Set Field script step, setting the field Contacts::testField.
From what you originally proposed as your problem, I don't think a script is needed at all. It seems to me you want to be able to manually enter text in the field, but just want to auto enter the first part, which is common to all. Logically, therefore, an auto enter calc along the lines suggested by Erolst with the "Do not replace existing" option checked will see the common text entered as soon as the record is created. Set the field to not select all text on entry, so that when you tab or click into the field you cursor will go to the end of what's already there ready for you to type away.
Thank you all for your responses and support.