Filtered browse screen and new records

Questions related to using nuBuilder Forte.

Filtered browse screen and new records

Postby alextouch » Thu May 21, 2020 6:54 pm

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
alextouch
 
Posts: 30
Joined: Tue Jun 05, 2012 10:10 pm
Location: Bologna, Italy

Re: Filtered browse screen and new records

Postby kev1n » Thu May 21, 2020 7:17 pm

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
 
Posts: 728
Joined: Mon Oct 15, 2018 2:13 am

Re: Filtered browse screen and new records

Postby kev1n » Thu May 21, 2020 9:02 pm

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
 
Posts: 728
Joined: Mon Oct 15, 2018 2:13 am

Re: Filtered browse screen and new records

Postby kev1n » Sun May 24, 2020 10:36 am

Please let me know if it works for you.
kev1n
 
Posts: 728
Joined: Mon Oct 15, 2018 2:13 am

Re: Filtered browse screen and new records

Postby alextouch » Wed May 27, 2020 4:30 pm

Hi Kevin,

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

Alessandro
alextouch
 
Posts: 30
Joined: Tue Jun 05, 2012 10:10 pm
Location: Bologna, Italy

Re: Filtered browse screen and new records

Postby alextouch » Thu Jun 04, 2020 11:13 pm

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
alextouch
 
Posts: 30
Joined: Tue Jun 05, 2012 10:10 pm
Location: Bologna, Italy


Return to General