Force selection of first record on query result.

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
johntalbott
Posts: 620
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Force selection of first record on query result.

Post by johntalbott »

Make sure "Select first record" is unchecked.
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
PointsWell
Posts: 1473
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Force selection of first record on query result.

Post by PointsWell »

Vlad gave me a fix for the endless loop. Let me look for it
johntalbott
Posts: 620
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Force selection of first record on query result.

Post by johntalbott »

Just to be sure ... this is with "Select first record" unchecked?

What happens if you remove this line?

Code: Select all

grid.select().click();
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
PointsWell
Posts: 1473
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Force selection of first record on query result.

Post by PointsWell »

Found the conversation with Vlad - note it requires you to use Processes as default operations rather than the built in operations.

I did not test it. Other priorities.

Would be nice to have a built in fix to consistently select the first record even with a refresh. Or be able to have queries listen to other queries rather than be driven by them,
Hi,

have you tried disabling auto-refresh of the process which runs as a default operation on the ShowChildren query?

(when you define an operation that starts a process there is a "No Auto-refresh" checkbox. Try ticking it.)

Best Regards,
Vladimir Simkin

-------------------------------------
Hi Vlad

I’ve discovered a situation that will generate an accidental infinite loop. I have created a sample BO for you which demonstrates this. This reflects what is happening on my system in a simplified way. This set up is due to the 1:1 Push operations of panels and the inability to m:1 Pull data from a source


Setup:

BOs
Parent
Child

Queries
All Parents - has default action SelectParent (see below)
ShowChildren of selected Parent - FIND Child where Child.obParent.ID=LIRU.IDParent, this query is set to auto refresh on the running of the Parents default Operation on Record (below) - ShowChildren has Select First Record set

Operations on Records
SelectParent - Set LIRU.IDParent - this runs on the All Parents view as a default action. It sets the LIRU.IDParent to the ID number of the Parent record.
ChildShowParent - default operation on record on query ShowChildren to start a process which just does VIEW Child.obParent USING a specified form.

ShowChildren query also has a render script on it
widget.bind("dataBound", function(e){
const grid = e.sender;
grid.select("tr:eq(0)");
grid.select().click();
})


The render script is required because the select first record is not respected when the grid refreshes following running of the SelectParent process.

If you just use View Object as the default operation then the issue doesn’t occur, BUT because I want to show the parent object of the Child (in order to show the multiple children of the Parent) I have to use an Process kicked off by the default action of the Query to VIEW Child.obParent USING ChildParent

This creates a situation where the Process runs, which is causing an unwanted refresh on the ShowChildren query, which causes the default action to kick off, which causes an unwanted refresh ad infinitum.


In the sample attached run it in test, it will open to the Administrator VP. The Admin VP has two tabs, select the tab Test, the Parent Record will be selected, which will cause the ShowChildren grid to refresh and then the loop will start. I have made the Test tab closable otherwise it locks me out of my single user dev environment.
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Re: Force selection of first record on query result.

Post by KnightWare »

Unchecked select first record - still loops.

There is an auto refresh set to when the lower right form is modifies (saved). But even removing that as a test does not help.
Jaymer
Posts: 2528
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Force selection of first record on query result.

Post by Jaymer »

I was also using a process as the default action.
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
PointsWell
Posts: 1473
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Force selection of first record on query result.

Post by PointsWell »

Jaymer wrote: Sat Jun 05, 2021 12:10 am I was also using a process as the default action.
Did you check the no auto refresh check box for the process on the default operation for the grid
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Re: Force selection of first record on query result.

Post by KnightWare »

Wait. What?
Stay tuned...
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Re: Force selection of first record on query result.

Post by KnightWare »

Winner Winner chicken dinner....

Pointswell - "Did you check the no auto refresh check box for the process on the default operation for the grid"? No I had not and that did the trick.

To summarize.
1. check the no auto refresh check box for the process on the default operation for the grid.
2. This code in the Render Script of the grid -

widget.bind("dataBound", function (e) {
const grid = e.sender;
const row = grid.table.find("tr:eq(0)");

parser.highlightRow(row, grid); // This is what highlights (selects) the row.
grid.select().click(); // This is only needed to run the default row operation.
})
Jaymer
Posts: 2528
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Force selection of first record on query result.

Post by Jaymer »

thx
appears to work for me now
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
karelh
Posts: 86
Joined: Wed Oct 26, 2016 10:20 pm

Re: Force selection of first record on query result.

Post by karelh »

HI all,

thank you for the info, this helps allot. Can this be done on a custom query? I have tried it but from the console I can see it does not find the widget. I assume the custom query is a different widget type?

Thanks!
Post Reply