Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

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

Questions related to using nuBuilder Forte.
paulkauz
Posts: 30
Joined: Fri Oct 30, 2020 7:08 pm

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

Unread post by paulkauz »

How can I jump from a list of projects to a filtered list of Work packages (PSP)'
You do not have the required permissions to view the files attached to this post.
If you like nuBuilder, please leave a review on SourceForge
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

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

Unread post by Janusz »

Hi,
You have to use:
https://wiki.nubuilder.cloud/ ... lectBrowse
and
https://wiki.nubuilder.cloud/ ... 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
paulkauz
Posts: 30
Joined: Fri Oct 30, 2020 7:08 pm

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

Unread post by paulkauz »

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
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

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

Unread post by Janusz »

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
paulkauz
Posts: 30
Joined: Fri Oct 30, 2020 7:08 pm

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

Unread post by paulkauz »

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
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

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

Unread post by Janusz »

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
paulkauz
Posts: 30
Joined: Fri Oct 30, 2020 7:08 pm

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

Unread post by paulkauz »

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
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

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

Unread post by Janusz »

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
paulkauz
Posts: 30
Joined: Fri Oct 30, 2020 7:08 pm

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

Unread post by paulkauz »

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
You do not have the required permissions to view the files attached to this post.
If you like nuBuilder, please leave a review on SourceForge
paulkauz
Posts: 30
Joined: Fri Oct 30, 2020 7:08 pm

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

Unread post by paulkauz »

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
Post Reply