Bug report: Brackets in text fields lead to errors in calculations

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms Bug report: Brackets in text fields lead to errors in calculations

Tagged: 

Viewing 6 reply threads
  • Author
    Posts
  • December 24, 2019 at 12:03 AM #38880

    Chris Ju
    Participant

    Hello Brendan,

    is there a way to prevent that?

    To reproduce that bug, you can put a text with brackets > “(” or “)” < in the text/note field and try to calculate with that field, e.g.

    IFNOTEMPTY (;”1″;”0″)

    Thanks
    Chris

    December 25, 2019 at 1:40 AM #38899

    Brendan
    Keymaster

    Hi Chris,

    I’ll have to look into this issue.

    In the meantime, a Script Field would do the job without this issue.

    Can you please email me your form template and I’ll test with what you have?

    Thanks,

    Brndan

    December 26, 2019 at 12:10 AM #38910

    Chris Ju
    Participant

    Here we go!

    Attachments:
    You must be logged in to view attached files.
    December 26, 2019 at 12:32 AM #38914

    Brendan
    Keymaster

    Hi Chris,

    Thanks for the template.

    Do you mean if I enter square brackets into the contents of one of your Note fields then it doesn’t work?

    Because it worked for me just fine. Although you are returning text instead of Numbers as you have your 1 and 0 surrounded with double-quotes. Since you have Tap Forms set to return a Number, you should return 0 and 1 instead of “0” and “1”.

    See attachment.

    Attachments:
    You must be logged in to view attached files.
    December 26, 2019 at 12:34 AM #38916

    Brendan
    Keymaster

    Oh, and instead of using the SUM() function, you can just add the values together like this:

    IFNOTEMPTY(S1; 1; 0) + IFNOTEMPTY(S2; 1; 0) + IFNOTEMPTY(S3; 1; 0) + IFNOTEMPTY(S4; 1; 0)

    December 26, 2019 at 12:40 AM #38917

    Chris Ju
    Participant

    No, it only leads to an error, if round bracket are used and if it’s not closed (see attachments)…

    Attachments:
    You must be logged in to view attached files.
    December 26, 2019 at 2:56 AM #38926

    Brendan
    Keymaster

    Oh I see. Sorry, I missed that it had to be just a single bracket.

    You’re right. It’s getting a parse error.

    invalid formula - unable to parse: Missing bracket ")" in expression <SUM(IFNOTEMPTY("One (";"1";"0");IFNOTEMPTY("[Two]";"1";"0");IFNOTEMPTY("Three";"1";"0");IFNOTEMPTY("Four";"1";"0"))>.

    I’ve been working on this issue this evening and I finally fixed it. You’ll be able to put any number of parentheses within your text now and Tap Forms will be able to properly parse the formula. It wasn’t checking for quotes properly before checking to see if the parentheses are balanced in the formula.

Viewing 6 reply threads

You must be logged in to reply to this topic.