Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Using Tap Forms 5 › Script error: ReferenceError: Can't find variable: photo_database, column:33, li
- This topic has 3 replies, 2 voices, and was last updated 6 years, 8 months ago by
Daniel Leu.
-
AuthorPosts
-
October 10, 2018 at 9:46 AM #30982
Daniel LeuParticipantHi
I have the parent database “Photo Database” with the child “Photo Prints”. The child database is used to keep track of all prints created and sold. In there, I would like to include some basic information from the parent database such as image title.
In the parent database I set the one-to-many link and enabled show inverse relationship. Then in the child database I created a field with the type ‘script’ containing
var image_title = photo_database.getFieldValue('fld-a64a1b71aeb8408499143d9c852b0056');
image_title;
But when I run it, following error:
ReferenceError: Can't find variable: photo_database, column:33, line:1
I guess I’m missing something to define photo_database which is the parent “Photo Database”. Attached is the sample template. Thank you for your help!
– Daniel
Attachments:
You must be logged in to view attached files.Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksOctober 10, 2018 at 3:58 PM #30985
BrendanKeymasterHi Daniel,
Yes, Tap Forms needs to know what photo_database is.
What you need to do is double-click on Photo Database on the fields list on the left. That’ll put in the definition for that.
So you’ll end up with:
var photo_database = record.getFieldValue('fld-70bf5e5c35da46ab863690f617313d17'); var image_title = photo_database.getFieldValue('fld-a64a1b71aeb8408499143d9c852b0056');
I realize it’s not obvious that the parent field name is double-clickable.
October 10, 2018 at 4:27 PM #30987
Daniel LeuParticipantHi Brandon,
Cool! Didn’t think of that at all.
When I run it in the ‘edit script’ view, the result is shown in the Results field. I would expect to see this in the Title field in the Layout View too, but that remains empty.
Sorry for all the beginners questions!
Thanks!
– Daniel
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksOctober 10, 2018 at 4:43 PM #30988
Daniel LeuParticipantIt helps to define the result type as text! Working now :)
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks -
AuthorPosts
You must be logged in to reply to this topic.