Help with Query on Form - (Query no relationship to OB)

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Madimant
Posts: 35
Joined: Tue Aug 08, 2017 11:39 pm

Help with Query on Form - (Query no relationship to OB)

Post by Madimant »

Can anybody help.

I have a 3 BO's in a cascading relationship - Clients > om_Policies >om_Items...
I want to display the 'om_Items' in a query on one of the 'Clients' forms but 'om_Items' is not in a direct relationship of 'Clients'.
The Client BO got 2 tabs named 'Client Profile' and 'Client Items'.

I can get a defined query to run and display correct items from a html button on the form 'Client Items' but it won't display on the same form 'Client Items' in the client. It opens in a popup or in the main VP new tab depending on options selected when programming.

Also tried using - AwareApp.runQuery('q_History','xxxx'); in the render scripts - and same thing - always opens to the VP tabs or popup.

How would I display a query on a form without a direct relationship to that Object form?

Any help will be appreciated...

Tj
Tj
Using Version 8.6 Build 2917 - mySQL
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Help with Query on Form - (Query no relationship to OB)

Post by Jaymer »

Expand your thinking to using a Visual Perspective.
I put this off for a year due to just not knowing about it... but you'd generally push your button on the client form, run a process to save the client_id in LIRU, then the VP content panel would refresh having seen the process run, and it runs the query which is using that LIRU field as a filter.

I know its not what you asked - because you said you have a 2 Tabs, and you want this in a tab (which is a form Section in Clients).

This is 1 solution... there may be another.
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
Madimant
Posts: 35
Joined: Tue Aug 08, 2017 11:39 pm

Re: Help with Query on Form - (Query no relationship to OB)

Post by Madimant »

I am already using the VP for a main screen with other queries linked to the client and their policies...
Adding another query would make it very cluttered.

Would just be more functional if I could display the client items query on a form linked to client.

I'm just not sure if there is a way in AwareIm to display a Non Relative Query on a form?

Thanks anyway Jaymer... appreciated.
Tj
Using Version 8.6 Build 2917 - mySQL
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Help with Query on Form - (Query no relationship to OB)

Post by Jaymer »

Madimant wrote:Would just be more functional if I could display the client items query on a form linked to client.
True, I have had to create Aware References between tables JUST BECAUSE I knew I needed to show the "many" records in a list on the form of the parent (grandparent technically, in your case).

Can you upload a Pic of your main screen?
Whats you're backend DB?
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: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Help with Query on Form - (Query no relationship to OB)

Post by PointsWell »

Im with Jaymer, the way to do this is to simulate a Form using a VP.

You are not actually showing a query on a form when you show an OM or PM attribute, you are showing the attributes of the BO that the form relates to. The representation is in a grid which coincidentally is one of the ways of viewing the results of a query.

As per Jaymer's suggestion build a VP that looks the way you want the form to look and for that distant relationship build a query filtered on an ID that you store in the LIRU. You can then interact with the VP in the style of a BO form.

If you are absolutely against building a virtual form in a VP then you would need to force a relationship back to the grandparent. You could do this by setting a business rule that inserts the grandchild into a PM on the grandparent.

eg. IF LevelThreeObject.obLevelTwoObject IS CHANGED THEN INSERT LevelThreeObject INTO LevelThreeObject.obLevelTwoObject.obLevelOneObhect.pmLevelThrees (you'd need to play around with this - I haven't tested this syntax as it may be more involved - I've been away from AIM for a while).

By doing so you are obviously creating a lot of redundancy into your data model. You'd obviously have to make sure that you were removing it from the original GrandParent in the unlikely event that you moved it to another GrandParent unless you put a PS relationship to the GrandParent in the GrandChild.
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Help with Query on Form - (Query no relationship to OB)

Post by johntalbott »

Madimant wrote:Can anybody help.

I have a 3 BO's in a cascading relationship - Clients > om_Policies >om_Items...
I want to display the 'om_Items' in a query on one of the 'Clients' forms but 'om_Items' is not in a direct relationship of 'Clients'.
The Client BO got 2 tabs named 'Client Profile' and 'Client Items'.

I can get a defined query to run and display correct items from a html button on the form 'Client Items' but it won't display on the same form 'Client Items' in the client. It opens in a popup or in the main VP new tab depending on options selected when programming.

Also tried using - AwareApp.runQuery('q_History','xxxx'); in the render scripts - and same thing - always opens to the VP tabs or popup.

How would I display a query on a form without a direct relationship to that Object form?

Any help will be appreciated...

Tj
It will take some creativity, but you should be able to do this using

Code: Select all

AwareApp.runQuery('q_History','xxxx')
You need to set xxxx to the ID of a DIV tag that will be the container for your query.
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
Madimant
Posts: 35
Joined: Tue Aug 08, 2017 11:39 pm

Re: Help with Query on Form - (Query no relationship to OB)

Post by Madimant »

Thanks for suggestion :D

The DB is mySQL and I already use 2 VP's similar to your suggestions.

The first one as a Main page where I display all the program stats, Staff, Clients etc
Image

Then once a client is selected the Client.ID is stored in LIRU and the secon VP opens with Policy Info
Image

If the operator the opens the 'Client' I bring up a popup with the Client information BO Forms
Image

And it is here on the 'History' tab that I would like to display all the client items insured across all policies
Currently I have to use the 'Get Items!' button to display the query in a popup/new tab on VP.
Image

It just made more sense to me to have it in the tab...

PointsWell - Your suggestion to create a relationship to could work but as you stated becomes cumbersome so would rather steer away from that...

John - I have tried the AwareApp.runQuery(‘My query’, ‘xxxx’) option but xxxx only points to a VP.
Your suggestion to use the ID of a DIV? Would that work in the renderOption as I found anything other than 'new_tab', 'main' only result in nothing coming up.
Is there anyway to find the ID of a Form that I could then use... something similar to AwareApp.getPanelId(frameType, tabName, panelName)? which work for VP but not Forms?

Many thanks for your help...
Tj
Using Version 8.6 Build 2917 - mySQL
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Help with Query on Form - (Query no relationship to OB)

Post by johntalbott »

Madimant wrote:
John - I have tried the AwareApp.runQuery(‘My query’, ‘xxxx’) option but xxxx only points to a VP.
Your suggestion to use the ID of a DIV? Would that work in the renderOption as I found anything other than 'new_tab', 'main' only result in nothing coming up.
Is there anyway to find the ID of a Form that I could then use... something similar to AwareApp.getPanelId(frameType, tabName, panelName)? which work for VP but not Forms?

Many thanks for your help...
In the History form section (tab):

1. Add a HTML cell with the following code

Code: Select all

<div id="itemhistory-container"></div> 
2. In the Render Script, add the following code

Code: Select all

/*Form section render scripts run each time the tab is selected.  We only want the query to run the first time the tab is selected, so determine if the query is already loaded.  If already loaded, do nothing.  If not already loaded, run the query and attach it to the div tag*/

if ($("#itemhistory-container").find("div.k-widget").length === 0) {
     AwareApp.runQuery("ItemHistoryQuery", "itemhistory-container")
}
Last edited by johntalbott on Mon Dec 03, 2018 12:26 am, edited 1 time in total.
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
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Help with Query on Form - (Query no relationship to OB)

Post by Jaymer »

Thx for posting the pics - yes, you've got the VP stuff well under control - hard to know what someone knows just from a simple post, but you've got that stuff under control.

So, John's suggestion is great.
His stuff is basically doing the same thing Vlad does using the configurator.
You're creating a named area on the screen and then the query will be executed with the results going to that area.... just doing it "outside" of aware.

Don't see which version you are in, but once you get to 8.2, you can assign a class to those Separators to tighten up the space they waste. A hack was needed prior to 8.2 (I think from AC/DC), but with simple CSS you can recover some of that wasted space.

Also, sometimes the grouping just doesn't fit in, but your use of that to see the Policies seems perfect, along with the Expansion of Rows. Makes all that info easily available to the end user !
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
Madimant
Posts: 35
Joined: Tue Aug 08, 2017 11:39 pm

Re: Help with Query on Form - (Query no relationship to OB)

Post by Madimant »

I'm using V8.2 latest build... need all the help I can get :-)

I can normally get by with searches and examples from the forum but when it comes to j scripts then I'm a bit lost.
Can read them but not always sure how to write them.

Thank John,
I tried the script and it runs but closes the form immediately.
I changed the render option to 'popup'

if ($("#itemhistory-container").find("div.k-widget").length === 0) {
AwareApp.runQuery("q_RisksSel", "popup");
}

to confirm that no error in script, then it did run and the query pops up in a popup window.
So it finds the ID but shuts the form down when trying to display in form .

Somehow I'm not sure if AwareApp.runQuery likes to write to anything other a VP or popup?
Tj
Using Version 8.6 Build 2917 - mySQL
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Help with Query on Form - (Query no relationship to OB)

Post by Jaymer »

this WILL work
you'll have to skype me
jaymerjaymer
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
Madimant
Posts: 35
Joined: Tue Aug 08, 2017 11:39 pm

Re: Help with Query on Form - (Query no relationship to OB)

Post by Madimant »

Working as example by John

Many thanks to John and Jaymer ---- :D :D :D :D :D :D :D
Tj
Using Version 8.6 Build 2917 - mySQL
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Help with Query on Form - (Query no relationship to OB)

Post by PointsWell »

This works but does not handle the placement of a Top Panel
Post Reply