I am trying to use the following Custom Query in a Drop Down Combo Box.
FIND WagonGRule WHERE (
(WagonGRule.GType='G2' AND Wagon_G_Event.ob_Wagon.G2InitialCreated<>'Yes') OR
(WagonGRule.GType='G48' AND Wagon_G_Event.ob_Wagon.G48InitialCreated<>'Yes') OR
(WagonGRule.GType='G40' AND Wagon_G_Event.ob_Wagon.G40InitialCreated<>'Yes'))
But Aware automatically changes is to the following... But this yields an incorrect Result.
FIND WagonGRule WHERE (
(WagonGRule.GType='G2' AND Wagon_G_Event.ob_Wagon.G2InitialCreated<>'Yes') OR
(WagonGRule.GType='G48' AND Wagon_G_Event.ob_Wagon.G48InitialCreated<>'Yes')
) OR
(WagonGRule.GType='G40' AND Wagon_G_Event.ob_Wagon.G40InitialCreated<>'Yes')
Any hints or ideas would be highly appreciated please?
Whst am I missing..... 🤪
-
- Posts: 2407
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Whst am I missing..... 🤪
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Re: Whst am I missing..... 🤪
The outside parentheses are irrelevant, so aware is removing them. That part makes sense. Maybe it’s just getting confused.
But I also think it would work with no parentheses at all, because the and should be evaluated first before the or.
Find w where a or b or c
Without your outside, parentheses, this is basically what you have. And no parentheses are needed here:
Find w where (a) or (b) or (c)
Find w where a and x or b and y or c and z
This should evaluate with no parentheses, but to be sure it could be rewritten as this:
Find w where (a and x) or (b and y) or (c and z)
Which gets back to my original statement of not having that extra set of outside parentheses
But I also think it would work with no parentheses at all, because the and should be evaluated first before the or.
Find w where a or b or c
Without your outside, parentheses, this is basically what you have. And no parentheses are needed here:
Find w where (a) or (b) or (c)
Find w where a and x or b and y or c and z
This should evaluate with no parentheses, but to be sure it could be rewritten as this:
Find w where (a and x) or (b and y) or (c and z)
Which gets back to my original statement of not having that extra set of outside parentheses
Last edited by Jaymer on Mon Dec 18, 2023 3:15 pm, edited 1 time in total.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 1460
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Whst am I missing..... 🤪
Assuming that you've cut and pasted the second FIND expression there's a really odd structure of parentheses
Putting it into a formatted open and close structure often helps
Don't understand why AIM would format it like that and in terms of logic it shouldn't make a difference.
Also looking at your find there doesn't seem to be anything tying WagonGRule to Wagon_G_Event
Putting it into a formatted open and close structure often helps
Code: Select all
FIND WagonGRule WHERE
(
(WagonGRule.GType='G2' AND Wagon_G_Event.ob_Wagon.G2InitialCreated<>'Yes
') OR
(WagonGRule.GType='G48' AND Wagon_G_Event.ob_Wagon.G48InitialCreated<>'Yes'
)
) OR
(
WagonGRule.GType='G40' AND Wagon_G_Event.ob_Wagon.G40InitialCreated<>'Yes'
)
Also looking at your find there doesn't seem to be anything tying WagonGRule to Wagon_G_Event