Bug report: Can’t find variable: record

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Script Talk Bug report: Can’t find variable: record

Viewing 10 reply threads
  • Author
    Posts
  • December 10, 2019 at 1:58 PM #38626

    Marcus
    Participant

    Since I‘ve installed 5.3.8 (968):

    A simple script to read a field value runs in the following error by executing Run – Script (record view):

    ReferenceError: Can’t find variable: record, column: x, line: y

    When I execute this script in the „edit mode“ it runs without any issues.

    
    function Test() {
    var title_id = 'fld-76b2c64fccc34c20b62b7d485f5bfa28';
    var result=record.getFieldValue(title_id);
    console.log(result)
    }
    
    Test();
    December 10, 2019 at 2:46 PM #38631

    Brendan
    Keymaster

    Hi Marcus,

    I just tested this out and it’s working for me. I first tested in my latest development build that I’ve made enhancements to the scripting engine. But then I tested it using the production version 5.3.8 and it also worked.

    Make sure you have a record selected in your form before you run the script.

    December 11, 2019 at 12:01 AM #38635

    Marcus
    Participant

    Hi Brendan,
    it occurs when a record is selected.

    The script below doesn‘t run in this error
    when I execute it during edit the script.
    It returns the title field value,
    but it doesn’t change the color as well.

    It occurs on iOS 13.2.3 (iPhone)

    
    function Test() {
    
    var title_id = 'fld-f7c25ccc01564c308c96fa08ca0da768';
    
    var result=record.getFieldValue(title_id);
      
    var color='0xFFFEFB00'
    record.setRecordColor(color);
    
    var color = record.getRecordColor();
    
    console.log(result)
    console.log(color)
    
    }
    
    Test();
    December 11, 2019 at 9:19 AM #38637

    Sam Moffatt
    Participant

    To clarify “record is selected” on iOS, does that mean you’re in the list view or the record detail/edit view? record isn’t set on the list view, only on the detail/edit view.

    December 11, 2019 at 11:34 AM #38639

    Marcus
    Participant

    I know the difference ?
    I am speaking about the record edit mode.

    Have a look, I made a quick screen record:

    It is reproducible on an old iPhone 6 as well.

    December 11, 2019 at 1:00 PM #38645

    Brendan
    Keymaster

    Ok. Thanks for the video. Now I see the problem with my code there.

    I was accidentally passing in the wrong variable to my runScript method. I recently refactored it and mistyped the parameter name when called on the record details screen.

    The next update will have it fixed.

    Before when I tested it and it worked, it was because I was using the Mac version and didn’t notice that you were using the iOS version.

    December 11, 2019 at 2:11 PM #38657

    Marcus
    Participant

    Glad to hear ?

    Thanks, Brendan.

    December 13, 2019 at 9:11 AM #38690

    Marcus
    Participant

    I can confirm it has been fixed in 5.3.8 (972).
    Thanks again.

    September 25, 2020 at 5:02 AM #42033

    matt coxon
    Participant

    Hi is there a chance this has come back i think I’m getting the same error , it works
    Perfectly on the Mac, but not iPhone or iPad IOS14, please have a look at the pic , thanks Matt

    September 25, 2020 at 9:37 AM #42034

    matt coxon
    Participant

    Hold on, might actually be working , watch this space

    September 25, 2020 at 9:48 AM #42035

    matt coxon
    Participant

    Sorry false alarm, all good now
    Matt

Viewing 10 reply threads

You must be logged in to reply to this topic.