Page 1 of 1

Filtered browse screen and new records

Posted: Thu May 21, 2020 11:24 am
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

Re: Filtered browse screen and new records

Posted: Thu May 21, 2020 11:47 am
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.

Re: Filtered browse screen and new records

Posted: Thu May 21, 2020 1:32 pm
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;	

}

Re: Filtered browse screen and new records

Posted: Sun May 24, 2020 3:06 am
by kev1n
Please let me know if it works for you.

Re: Filtered browse screen and new records

Posted: Wed May 27, 2020 9:00 am
by alextouch
Hi Kevin,

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

Alessandro

Re: Filtered browse screen and new records

Posted: Thu Jun 04, 2020 3:43 pm
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

Re: Filtered browse screen and new records

Posted: Fri Jun 05, 2020 5:35 am
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!

Re: Filtered browse screen and new records

Posted: Mon Jun 08, 2020 9:21 am
by alextouch
Ok!