Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Script Talk › Re class a field typer after script. (Web Location)
August 26, 2019 at 6:29 AM #36512
Hi, I’m using the vlookup script by (Sam Moffatt) great script thank you Sam!!!
Is there a way to make a script field be a clickable URL / Hyperlink (as it would be if you had selected the “Web Site” field
This is the script,
var trello_cards_id = ‘fld-a6346935a6af40d1833fad4f49958bca’;
var tsm_rfs_id = ‘fld-b0c9111f87064a23bde75c965374e97c’;
var short_url_id = ‘fld-7888517ad8204f5aa7a4bf926c92be15’;
var rfs = record.getFieldValue(‘fld-e13aa1493c6f4b919f30b27cd8bc8ae9’);
vlookup(rfs, trello_cards_id, tsm_rfs_id, short_url_id);August 26, 2019 at 2:04 PM #36522
You can’t make a script field clickable (would be nice, it’s on my wish list*) however as a workaround what you can do is use the script field to set the value of a web site field using
record.setFieldValue(field_id, value). Then when the script is run, it’ll update the web site field to be the new value which means you can then click on that field to open the link.
* I’d actually like a way of being able to define a custom icon for a script field and an action handler distinct from value. I think it’d be cool to have the ability to have the script field display one value but when you click it, it opens up a link or perhaps even runs a form script with a
fieldcontext set. Doing all of that and getting it right is a lot of work and perhaps a little too powerful.August 28, 2019 at 5:21 AM #36575
Hi Sam, thanks very much for the response, I understand what you mean but can’t seem to get the syntax correct
Do I add the command to the main script field after the vlookup or in a new script field I played around with various but can’t seem to get it to work, but when I do I’ll need to apply it to date fields in the same scenario as the web field so will be very useful
ThanksAugust 28, 2019 at 6:29 AM #36576
You’ll need to create a new web site field to put the data into. Then your script just needs to know what that field ID is and then set it:
form.runScriptNamed('vlookup'); var trello_cards_id = 'fld-a6346935a6af40d1833fad4f49958bca'; var tsm_rfs_id = 'fld-b0c9111f87064a23bde75c965374e97c'; var short_url_id = 'fld-7888517ad8204f5aa7a4bf926c92be15'; var website_id = 'fld-yourfieldhere'; var rfs = record.getFieldValue('fld-e13aa1493c6f4b919f30b27cd8bc8ae9'); var website = vlookup(rfs, trello_cards_id, tsm_rfs_id, short_url_id); record.setFieldValue(website_id, website); website;
Something like that should work, hopefully it makes sense.
website_idis the new field you add to store the URL and make clickable, I put
websiteinto a variable so that I can use it to set and then use it as the return value for the script (kinda redundant but not harmful). You could probably hide the script field once it’s all working.
Works perfectly now , thanks very much for the further details
You must be logged in to reply to this topic.