I need to produce a list of results (and ultimately print a report) based upon selecting a road from an existing table and having the resulting list show all entries from the other table where the road_id matches.
If I create a fastform that accesses my roads table I can filter the data and select the road I am interested in. However, as soon as I select a road it takes me to an edit screen whereas what I really need is another form that shows all the related data based on that roads #RECORD_ID#. Am I missing the blindingly obvious?
Or am I better using a subform or iframe on the main browse form screen? All thoughts welcomed inclduing any other way of doing it.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
What's my best option? Subform, iframe or something else?
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: What's my best option? Subform, iframe or something else?
I would do it in the same way as you've done before. 2 Browse and filter the 2nd based on the selection in the 1st.
Re: What's my best option? Subform, iframe or something else?
Hi kev1n
I'm having a bit of difficulty setting up some JS using nuSelectBrowse. My plan is to click on a road name in my tblRoads which will then open a new browse form (frm_values) which shows related data from the tbl_Properties and tblValues tables. Here is the custom code on the roads form (frm_roads). The primary key is a foreign key in tbl_Properties
Then in my second browse form (frm_values) I have this SQL to theoretically show every record that matches the hash cookie #roadref# in the id_Roads field .
For convenience I also attach a diagram of my tables.
When I click on a road I just get an empty browse form showing, which doesn't even have any column headings. Neither debug or F12 help me.
I'm having a bit of difficulty setting up some JS using nuSelectBrowse. My plan is to click on a road name in my tblRoads which will then open a new browse form (frm_values) which shows related data from the tbl_Properties and tblValues tables. Here is the custom code on the roads form (frm_roads). The primary key is a foreign key in tbl_Properties
Code: Select all
function nuSelectBrowse(e) {
var roadID = $(e.target).attr('data-nu-primary-key');
nuSetProperty('roadref',roadID)
nuForm('frm_values', '','' , '', '0');
return false;
}
Code: Select all
SELECT
tblValues.*,
tblProperties.*
FROM
tblValues
JOIN tblProperties ON tblValues.id_Properties = tblProperties.idProperties
WHERE
((tblProperties.id_Roads = '#roadref#'))
When I click on a road I just get an empty browse form showing, which doesn't even have any column headings. Neither debug or F12 help me.
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: What's my best option? Subform, iframe or something else?
nuForm() expects a Form ID (e.g. "63e3d7bd4e10f60"), not a Form Code. Press Ctrl+Shift+M on the form you'd like to open to see it.
Re: What's my best option? Subform, iframe or something else?
I see, thanks!
I am a step closer in that I now at least get a browse form opening up. However it doesn't show any data. If I remove the #roadref# from my SQL and put in a random road id I get results so I know the subsidiary form is working. It looks like it's not passing the hash cookie through.
I am a step closer in that I now at least get a browse form opening up. However it doesn't show any data. If I remove the #roadref# from my SQL and put in a random road id I get results so I know the subsidiary form is working. It looks like it's not passing the hash cookie through.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: What's my best option? Subform, iframe or something else?
Try setting a global Hash Cookie:
If that doesn't work either, I have another trick up the sleeve...
Code: Select all
nuSetProperty('roadref',roadID, true)
If that doesn't work either, I have another trick up the sleeve...