Query Builder issues

I seem to be having issues with structures like this

{status: "500", message: "Cannot read property 'get' of undefined",…}
message: "Cannot read property 'get' of undefined"
stack: "TypeError: Cannot read property 'get' of undefined\n    at value (/opt/node_app/lib/core/parser.js:610:51)\n    at /opt/node_app/lib/core/parser.js:694:21\n    at == (/opt/node_app/lib/core/parser.js:57:39)\n    at /opt/node_app/lib/core/parser.js:421:42\n    at parser (/opt/node_app/lib/core/parser.js:356:19)\n    at Object.parseValue (/opt/node_app/lib/core/parser.js:729:24)\n    at filterConditional (/opt/node_app/lib/core/app.js:517:53)\n    at Array.filter (<anonymous>)\n    at App.filterConditional (/opt/node_app/lib/core/app.js:518:45)\n    at Array.filter (<anonymous>)"
status: "500"

Anybody mind testing a similar structure to check if this is just me please.

Please check your server action code for some old code left. Maybe you removed some parts from the UI but they left in the code.
Maybe just recreate this query and test again?

1 Like

Hi Teo, so I tried that out, recreated the server action from new, and did a far simpler version of it with the main thing being the Conditions tab, where I used an AND with 2 OR groups inside, making sure to use the simplest conditions only and leaving off any of the more complicated ones that need formatters etc.

Same error occurs on my side.

After the error I opened the server action in code view and copied out the select statement and tested it in Navicat and it did work with the code Wappler generated for the query, so not really sure.

This means some of your get variables probably doesn’t return a value … or is missing :slight_smile:
Maybe try removing the conditions on e by one to see which one is causing it.

This is what my test server action looks like, it only has one multi query in it

The first OR group is getting data directly from the database and both conditions will be met as the database has NULL and 0 and 1 to ∞, I only want 0 or NULL returned.

The next OR groups both have conditions on, so should allow no value till the user chooses some of the on page filtering options.

Can you see if I have done something silly here please Teo, I am a little short on sleep, so nothing would surprise me.

EDIT: Also none of my $_GET variables have any server or client validation either.

can you try this:

The only way I can get it working is by not having multiple groups, so this works

But if I take those 2 bottom groups and put then in their own OR group, then although the SQL is valid and tested it returns that error.
It is difficult to simplify the query more, because to make a group i need 2 elements, so to make 2 groups I need 4 elements.

Maybe @patrick can take a look at this.

1 Like

Thanks Teo, I have exhausted my brain power on it, lol

Could you send me the server action json, you can send it me in a private message.

1 Like

Sent it Patrick, it’s like there are too many groups inside groups, so the UI is showing

AND [
    OR [

    ],
    OR [

    ]
]

But the code is more like

AND [
    OR [

    ],
    OR [
        AND [

        ]
    ]
]

That last third tier AND only happens when I make each part a group inside the OR, and I have to make it a group to get the UI to allow me to add a condition to each one.

I’ve seen this but not had a chance to report it. As you know, it seems to be where a sub-group has a condition whether or not to apply.

My main point is, however that it’s not just a single user issue.

1 Like

Please test following update, unzip to lib/core.

app.zip (3.7 KB)

2 Likes

Initial test says the error is gone, just checking a little more, one moment.

Thank you so much, working perfectly now :), so happy I was not nuts. haha

This has been fixed in Wappler 4.0.4

This topic was automatically closed after 44 hours. New replies are no longer allowed.