
How to add buttons that create new records or search records in a table
The little + and magnifier icons on subtables are quite small, and I have team members who need big coloured buttons with writing on so they know how to search or create records! What formula should I put on the buttons to achieve this? Can't figure this out from the manuel, sorry!
-
I have a table named Plants, and it has a subtable name PlantLog.
This is the script I use on a button on the Plant form to create a new record in PlantLog. It also causes the new PlantLog record to open.
let myID := Id;
let NN := (create PlantLog);
NN.(Plants := myID);
popupRecord(record(PlantLog,number(NN.Id))) -
My version of your script is:
let myID := Id;
let NN := (create IMAGES);
NN.(LEADER := myID);
popupRecord(record(IMAGES,number(NN.Id)))It's throwing up the error message: Expression must return a number or record id: myID at line 3 column 19.
I'm in LEADER, trying to create a new record in IMAGES. What's going wrong?
-
Hmm...
in the line
NN.(LEADER := myID);
LEADER is the name the reference back to the LEADER table. I think be default the link back is named the same as the table, but the link can be renamed to something else. If you renamed the reference in IMAGES back to LEADER, you will need to make sure the third line used the reference name, not the LEADER table name.
that may not be the issue, but that is my first thought
-
David.. it is a "feature".. the Id field is stored internally as a number field.. but when you simply compare them.. it is a text field.. I was snagged by this "got-cha" when writting an application to manage our Statement Of Works (SOW)/Contracts.. and struggled for a while.. until Support clued me in.. :)
-
Wait a minute, this didn't work quite as well as I thought. The script is:
let myID := number(ID);
let NN := (create IMAGES);
NN.(LEADER := myID);
popupRecord(record(IMAGES,number(NN.Id)))It calls up the IMAGE popup, lets you insert pictures, but it doesn't assign the new IMAGE record to the LEADER record where the script is. Is something missing?
-
If this script creates a new record in IMAGES:
let myID := this;
let NN := (create IMAGES);
NN.(LEADER := myID);
popupRecord(record(IMAGES,number(NN.Id)))... how do I need to adjust it to open an existing record in IMAGES? I'm placing several images on one record rather than having a different record for each image).