IN query self reference issue?

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

IN query self reference issue?

Post by swiftinitpvtltd »

I have below process query
FIND ProductBO WHERE ProductBO.ID IN (another BO multiple ProductBOID's....

Is there any sample of IN query in guide or forum?
Last edited by swiftinitpvtltd on Sat Feb 16, 2019 1:52 am, edited 1 time in total.
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: IN query working sample?

Post by PointsWell »

You are mixing objects and attributes in your query

Should be

Code: Select all

FIND ProductBO where ProductBO in AnotherBO.pmProducts
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Re: IN query working sample?

Post by swiftinitpvtltd »

Thanks! It kind of worked but it started doing infinite loop like behavior. The In will have 100+ records.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: IN query working sample?

Post by tford »

Thanks! It kind of worked but it started doing infinite loop like behavior. The In will have 100+ records.
If you post the details of what you have + explanation of the BO / attribute relationships, we might be able to help.
Tom - V8.8 build 3137 - MySql / PostGres
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Re: IN query working sample?

Post by swiftinitpvtltd »

Thanks tford.
I have a BO
BO1
BO1 contains ProductName and I also have multiselector in the same BO edit form to select same BO names multiple times(discounted products for this product for example). So if I add one products other 3 products are discounted.
Now The IN query is like
FIND BO1 WHERE BO1 IN ThisBO1.ob_DiscountedProducts (ob_DiscountedProducts is multiselector to select discounted products for same BO)

DISPLAY MESSAGE COUNT BO1 WHERE BO1 IN ThisBO1.ob_DiscountedProducts

returns blank.
I do see 3 multichoice values in log if user selects 3 discounted products but above query returns 0

similar issue mentined here-
https://awareim.com/forum/viewtopic.php ... d+query+IN

for me
FIND OrderLines WHERE OrderLines IN ThisOrderLines.ps_LinkToContractorOrderLine
DISPLAY MESSAGE SEARCH_COUNT
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Re: IN query self reference issue?

Post by swiftinitpvtltd »

Now I do see 3 products in batches of 1 FIND query which is good!

But now when I do insert(create) action for another purpose(to insert these 3 in another transaction BO) on this its inserting current(4th) product thrice instead of adding these 3 multiselected products of current product.
I tried
ThisProduct, ThatProduct and Product but its doing it thrice meaning its almost working but not getting those 3 in create.

FIND BO1 WHERE BO1 IN ThisBO1.ob_DiscountedProducts in batches of 1(finds 3 as I have selected 3 in that item edit)
Create BOTrans with (this inserts same current product thrice instead of 3 different products from above query)
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: IN query self reference issue?

Post by customaware »

Amit, if you are using the ob_ prefix properly then there is ONLY 1 record.

Very hard to understand what you are trying to achieve......

How about a small diagram or a sample bsv and we might be able to assist
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Re: IN query self reference issue?

Post by swiftinitpvtltd »

Thank Mark. Its now almost working except out of 3 one item is showing blank as I am selecting same product in discounted products list. This is little weird issue.
For now I found a good workaround but there is a issue for sure with self reference BO FIND query(in case you refer same item in multiselector column the find query only finds 2 other items in batch query except the current item-3 items selected in multiselector with one of them as current item).
I will create a BSV in next week to show the issue.
Post Reply