Jump from a browse form to a filtered browse and edit form

Questions related to using nuBuilder Forte.

Jump from a browse form to a filtered browse and edit form

Postby paulkauz » Sat Nov 14, 2020 6:21 pm

How can I jump from a list of projects to a filtered list of Work packages (PSP)'
Attachments
Bildschirmfoto 2020-11-14 um 09.39.33.png
List of work packages
Bildschirmfoto 2020-11-14 um 09.39.33.png (32.27 KiB) Viewed 190 times
Bildschirmfoto 2020-11-14 um 09.38.48.png
List of projects
Bildschirmfoto 2020-11-14 um 09.38.48.png (41.27 KiB) Viewed 190 times
If you like nuBuilder, please leave a review on SourceForge
paulkauz
 
Posts: 27
Joined: Sat Oct 31, 2020 3:38 am

Re: Jump from a browse form to a filtered browse and edit fo

Postby Janusz » Sun Nov 15, 2020 8:27 am

Hi,
You have to use:
https://wiki.nubuilder.net/nubuilderfor ... lectBrowse
and
https://wiki.nubuilder.net/nubuilderfor ... ipt#nuForm

You can define the action related to the whole row or to specific columns clicked. For example if you click on let say column 3 then it will redirect you specific form with some filter and if you click on any other column then you will have standard behavior.

To start with - first paste the following code to JS custom code and in the console (F12) you will see just data after click with other links deactivated:
Code: Select all
function nuSelectBrowse(e){
var r = $('#' + e.target.id);
console.log(r.attr('data-nu-primary-key'),'\n',r.attr('id'),'\n',r.attr('data-nu-row'),'\n',r.attr('data-nu-column'),'\n',r.html() );
}

after you can use these data with nuForm to define whatever action you want for example:
Code: Select all
function nuSelectBrowse(e){
var r = $('#' + e.target.id);
nuForm(nuGetProperty('form_id'), '', r.html(), '', '0');
}
If you like nuBuilder, please leave a review on SourceForge
Janusz
 
Posts: 399
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: Jump from a browse form to a filtered browse and edit fo

Postby paulkauz » Sun Nov 15, 2020 8:40 pm

Thanks Janusz
Its not exactly what I have in mind. What do I have to do to Jump form a form called 'BKW_MassnahmenPSP_Browse' to a form called 'BKW_MassnahmenPSP'
The first form list's all the projects, the second form all the PSP's of all projects.
My intention is to select in the first form a project and jump to the secend form with all the PSP's belonging to the selected projects.
The first Form is a browse form the second form is browse / edit.

It's like in a tree where i want to go down and either add a new PSP or select an existing one to edit it.

BR paul
If you like nuBuilder, please leave a review on SourceForge
paulkauz
 
Posts: 27
Joined: Sat Oct 31, 2020 3:38 am

Re: Jump from a browse form to a filtered browse and edit fo

Postby Janusz » Sun Nov 15, 2020 9:20 pm

Normally should work. In nuForm you just need to indicated ID of the new form
so instead of:
Code: Select all
nuForm(nuGetProperty('form_id'), '', r.html(), '', '0');

you have to put someting like that where on the first place you have new form ID.
Code: Select all
nuForm('5c2cc8b574d9550', '', r.html(), '', '0');

to find ID of new form - open it - and use nuCurrentProperties() in the console
belowe output example:
Code: Select all
nuCurrentProperties()
{form_id: "5c2cc8b574d9550", redirect_form_id: "5c2cc8b574d9550", record_id: "5f75dc9d634f734", title: "Oferty DU", call_type: "", …}
If you like nuBuilder, please leave a review on SourceForge
Janusz
 
Posts: 399
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: Jump from a browse form to a filtered browse and edit fo

Postby paulkauz » Sun Nov 15, 2020 10:58 pm

Thnks for that on. It works and brings the browse form. How can I pass the ID of the project as a filter criteria.
In the project table its called "MassnID" and in the PSP table PSP_MassnID"
If you like nuBuilder, please leave a review on SourceForge
paulkauz
 
Posts: 27
Joined: Sat Oct 31, 2020 3:38 am

Re: Jump from a browse form to a filtered browse and edit fo

Postby Janusz » Mon Nov 16, 2020 1:04 am

The simplest solutions.
Use following code. Click on any cell on browse form containing MassnID.
Code: Select all
function nuSelectBrowse(e){
var r = $('#' + e.target.id);
nuForm('your-new-form-id', '', r.html(), '', '0');
}

and in the new form it will display all record having in any field string including MassnID (in fact equal to r.html()).
You have to analyse if in this approach it will be displayed more than you need or just what you need.
To limit redundancy you can just add in the browse form some special notation for example if you have Projektnummer equal to 17 it will be difficult to find as number 17 can be present in many other cells.
But if you will be looking for .17. instead of 17 - then it would be quite easy to find.
to have it - you can replace in the browse form PSP_MassnID with
Code: Select all
concat('.',PSP_MassnID,'.')
and use in above code:
Code: Select all
nuForm('your-new-form-id', '', '.'+r.html()+'.', '', '0');
If you like nuBuilder, please leave a review on SourceForge
Janusz
 
Posts: 399
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: Jump from a browse form to a filtered browse and edit fo

Postby paulkauz » Mon Nov 16, 2020 1:40 am

Is it not possible to pass the data-nu-primary-key="1" (the MassnID) from the first form as a filter criteria for the PSP_MassnID field to the second form.
If you like nuBuilder, please leave a review on SourceForge
paulkauz
 
Posts: 27
Joined: Sat Oct 31, 2020 3:38 am

Re: Jump from a browse form to a filtered browse and edit fo

Postby Janusz » Mon Nov 16, 2020 4:05 am

Difficult to answer now - I do not know the structure of your DB.
In my case I use the approach as described above and works fine.
If you would have some DB example with dummy data - I could have a look.

Maybe others will have some idea.
If you like nuBuilder, please leave a review on SourceForge
Janusz
 
Posts: 399
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: Jump from a browse form to a filtered browse and edit fo

Postby paulkauz » Mon Nov 16, 2020 7:11 am

Jumping from the first form with the primary key 1 should then open the second form with all the foreign keys with 1
Thanks for any suggestions
Attachments
pz9dr-tw9uk.gif
pz9dr-tw9uk.gif (898.22 KiB) Viewed 124 times
If you like nuBuilder, please leave a review on SourceForge
paulkauz
 
Posts: 27
Joined: Sat Oct 31, 2020 3:38 am

Re: Jump from a browse form to a filtered browse and edit fo

Postby paulkauz » Tue Nov 17, 2020 2:56 am

Code: Select all
function nuSelectBrowse(e){
var r = $('#' + e.target.id);
nuForm("5faebeae9db455f", '', r.attr('data-nu-primary-key') , '', '0');
}


How can I use the value of the r.attr('data-nu-primary-key') in the select statement of the form "5faebeae9db455f"

Is that possible?
If you like nuBuilder, please leave a review on SourceForge
paulkauz
 
Posts: 27
Joined: Sat Oct 31, 2020 3:38 am

Next

Return to General



cron