Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Filtered browse screen and new records

Questions related to using nuBuilder Forte.
Post Reply
alextouch
Posts: 38
Joined: Tue Jun 05, 2012 2:40 pm
Location: Bologna, Italy
Contact:

Filtered browse screen and new records

Unread post by alextouch »

Hi,

I have this scenario:
A company with 3 departments, say A, B and C, and a shared human resource office that edit data for all employees (e.g. name, surname, address, and so on).

I made a table (and a form) that collects data from all departments, inserting a column "department" into the table itself.
Then I insert three buttons in the home screen, say HR-A, HR-B, HR-C, each one run same form but with A, B or C in the Filter field, because I need to have three separate lists.

But when I add a new record, I want to write into the database table (PHP After Save) the right department value based on filter applied to the browse screen in the run/filter field... or, that it's the same, populate a hidden field in the edit screen with filter value A, B or C, so that the employee doesn't have to choose department from a dropdown list when he adds a new person.

But if I do a nuDebug(nuHash()) in PHP Before Edit, I cannot read "filter" hash variable, this is present only in the Before Browse.

Please can someone help me?

Thank you in advance.
Alessandro
kev1n
nuBuilder Team
Posts: 4562
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:

Re: Filtered browse screen and new records

Unread post by kev1n »

Hi Alessandro,

You could use the sessionSorage property to store and retrieve the department value: https://www.w3schools.com/jsref/prop_wi ... torage.asp

Use a button's onclick event (Custom Code) to add the JavaScript.
kev1n
nuBuilder Team
Posts: 4562
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:

Re: Filtered browse screen and new records

Unread post by kev1n »

Here's a JS function to retrieve a Browse filter. The function works both in a Browse and Edit screen.

Code: Select all

function getBrowseFilter() {

    var ft = nuFormType();
    var f;
    if (ft == 'edit') {
        f = nuFORM.breadcrumbs[nuFORM.breadcrumbs.length - 2].filter;
    } else if (ft == 'browse') {
        f = nuCurrentProperties().filter;
    }
    return f;	

}
kev1n
nuBuilder Team
Posts: 4562
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:

Re: Filtered browse screen and new records

Unread post by kev1n »

Please let me know if it works for you.
alextouch
Posts: 38
Joined: Tue Jun 05, 2012 2:40 pm
Location: Bologna, Italy
Contact:

Re: Filtered browse screen and new records

Unread post by alextouch »

Hi Kevin,

thank you for your answer, I will test ASAP and let you know if it works.

Alessandro
alextouch
Posts: 38
Joined: Tue Jun 05, 2012 2:40 pm
Location: Bologna, Italy
Contact:

Re: Filtered browse screen and new records

Unread post by alextouch »

Kevin,

it's simply PERFECT!

Another thing I need is: there is a way to launch a secondary "home" form from a button?
Or better, I want to put in a launch form 2 buttons say "DEPARTMENT 1", "DEPARTMENT 2" and clicking on each button will launch a new "nuhome2" or "nuhome3" in which I put same buttons (say HR, INVOICES, and so on), each filtered by department name.

Thank you again for your support.

Alessandro
kev1n
nuBuilder Team
Posts: 4562
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:

Re: Filtered browse screen and new records

Unread post by kev1n »

Hi Alessando,

I saw your question only by accident since your initial post has been edited.
May I ask you to open a new topic for this question? It will be easier for others to find answers in the future. Thanks!
alextouch
Posts: 38
Joined: Tue Jun 05, 2012 2:40 pm
Location: Bologna, Italy
Contact:

Re: Filtered browse screen and new records

Unread post by alextouch »

Ok!
Post Reply