Use global Hash Cookies (3rd paramer true)
From a previous reply:
https://forums.nubuilder.cloud/viewtopic. ... 002#p24092
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Searching on multiple fields
Re: Searching on multiple fields
That's what Im trying to do. I don't understand why its not working?
Do I do it like this: nuSetProperty('SQLSEARCH', sql, true);
Why then am I able to access the FRM_lastname variable in the called form, but not FRM_lname?
Do I do it like this: nuSetProperty('SQLSEARCH', sql, true);
Why then am I able to access the FRM_lastname variable in the called form, but not FRM_lname?
-
- nuBuilder Team
- Posts: 4302
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Searching on multiple fields
Should this Hash Cookie only be available on client-side (JavaScript)? Then try setting a variable with window.yourvariable = 'something' and retrieve it again with
window.yourvariable
window.yourvariable
Re: Searching on multiple fields
I got this to work using the global HKs. I do have another question. What I've done has an interesting result. I use my Launch from that I have my search fields on to build an SQL statement and save it in a global HK FRM_srchsqlform. Then on my browse/edit form I added this to the browse screen SQL :
AND
IF('#FRM_srchsqlform#' = 'Y', #FRM_search#, 1)
This results in adding my long SQL statement for all the fields that I have on my launch form to my browse/edit form SQL. ie:
What happens is that if I get a lot of results after my search form, I can then type a value in the browse screen search field and click search and it will hold that variable data from the #FRM_srchsqlform#' and add to it the CONVERT statements that the normal browse/edit form adds to the SQL, ie:
and further limits the results.
The question I have, Im not sure if I want that or not. Its a neat feature, but could be confusing for a typical end-user. So how then could I wipe out the variable #FRM_srchsqlform# after those original results are displayed? I suppose I could use the BE code to clear it. Thinking that if the user then clicks a record in the browse list to edit that record, I'd want to force them to search for something new once they exit the edit form, right?
AND
IF('#FRM_srchsqlform#' = 'Y', #FRM_search#, 1)
This results in adding my long SQL statement for all the fields that I have on my launch form to my browse/edit form SQL. ie:
Code: Select all
if (lastname != "") {
if (sql != "") {
sql = sql + " AND TaxCustomers.cust_lastname LIKE '" + lastname +"%'";
} else {
sql = sql + "TaxCustomers.cust_lastname LIKE '" + lastname +"%'";
}
}
Code: Select all
CONVERT(cust_firstname USING utf8) LIKE "%john%" OR CONVERT(cust_address USING utf8) LIKE "%john%" OR CONVERT(tax_billdate USING utf8) LIKE "%john%" OR CONVERT(tax_taxyear USING utf8) LIKE "%john%" OR CONVERT(tax_preparer USING utf8) LIKE "%john%"
The question I have, Im not sure if I want that or not. Its a neat feature, but could be confusing for a typical end-user. So how then could I wipe out the variable #FRM_srchsqlform# after those original results are displayed? I suppose I could use the BE code to clear it. Thinking that if the user then clicks a record in the browse list to edit that record, I'd want to force them to search for something new once they exit the edit form, right?
-
- nuBuilder Team
- Posts: 4302
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Searching on multiple fields
By setting a global empty Hash Cookie with nuSetProperty()?
Or depending on your SQL a condition that always results in true like WHERE 1=1
Or depending on your SQL a condition that always results in true like WHERE 1=1