How to run a query dependent on another query

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ekwo
Posts: 15
Joined: Mon Nov 29, 2021 11:16 pm

How to run a query dependent on another query

Post by ekwo »

Hi all
I hope some of you experts can explain how and the best way to run a query based on another query's highligted record (the record where the cursor points)
Query1 at the left or on the top of the screen shows Departments.
when moving towards the department records, Query2 to the right/or below will show all Employees belonging to the current department.

I have searched the user guide and the tutorials, but haven't find anything similar.

Best regards
Evelyn
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: How to run a query dependent on another query

Post by Jaymer »

I imagine you’re using a visual perspective with content panels.
Your first query is in one panel.
Don’t put a second query in the other panel.
But there’s a setting in the properties of the first panel that directs output to the second panel

Then just have a row operation on the first query.
It’s a default operation
It runs the second query with the output to the default location

In this special case, you don’t need to actually pass anything to the second query, just reference the parent field (as if it’s magically in memory) in the where statement
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
ekwo
Posts: 15
Joined: Mon Nov 29, 2021 11:16 pm

Re: How to run a query dependent on another query

Post by ekwo »

Thank you Jaymer!
I'm not sure I understand. I've managed to see the details, but it apperars in a new window.
Please see my questions below marked red.

I imagine you’re using a visual perspective with content panels.
Your first query is in one panel.
Don’t put a second query in the other panel.
But there’s a setting in the properties of the first panel that directs output to the second panel
Do you mean the Output Target properties?

Then just have a row operation on the first query. I guess you mean the Operations with records property ?
It’s a default operation
It runs the second query with the output to the default location

In this special case, you don’t need to actually pass anything to the second query, just reference the parent field (as if it’s magically in memory) in the where statement

Another question: I don't want to allow any columns to be inline edited, but as fare as I can see, at least one column must be editable in order to have the functionallity to prosess the second query by click on the record (not a button)
ekwo
Posts: 15
Joined: Mon Nov 29, 2021 11:16 pm

Re: How to run a query dependent on another query

Post by ekwo »

Jaymer,
I have now managed to see the details (query2) as you described.

My only problem now is: I don't want to allow any columns to be inline edited, but as fare as I can see, at least one column must be editable in order to have the functionallity to refresh the second query by click on the record (not a button)
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: How to run a query dependent on another query

Post by BLOMASKY »

I will jump in, although Jaymer is both much more elequent and better looking.

On your 1st query, you can have an operation with records process that is automatically triggered when you click anywhere on the row. When you create the "Operation with records" process make sure you set "default" to yes. This process can run the query or do most anything. In addition, this process can have the query record passed to it, so you can use it for filtering or access control or ???.

Does this make sense?

Bruce
ekwo
Posts: 15
Joined: Mon Nov 29, 2021 11:16 pm

Re: How to run a query dependent on another query

Post by ekwo »

Thank you Bruce
I'm not able to get the query2 to run when navigating to another record, It seems like I ned at button to fire the process.
I have created an "Operation with Records" of type "Start Process" and Default = Yes


Evelyn
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: How to run a query dependent on another query

Post by BLOMASKY »

then you are 1/2 way there. I assume your process is called whenever you click on a record in the parent grid (you can easily test this with a display message in that process. Now for the next step (This is a little diff from the way Jaymer suggested, but, as you probably know, there is more than one way to accomplish tasks using Aware.

Step 1, In this process that is called when clicking on a row, save the record in LoggedInRegularUser (LIRU).
Step 2, where you want the NEW query to be displayed, change that cell to an HTML cell and it can NOT be empty. (you can put an   there)
Step 3, For this new HTML cell, create an AutoRefresh rule that is triggered whenever the process in step 1 is run
Step 4 Have the autorefresh RUN a Process.
Step 4 1/2: Have this new process DISPLAY QUERY where the query has the WHERE clause referencing the LIRU column you updated in step 1.

DONE!

Bruce
Post Reply