I have a button in a edit screen.
I would like to launch a browse screen with a filter based in a field of edit screen.
Its posible that?
Thanks in advantage.
Antonio
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.
Filter a browse screen from a button
Re: Filter a browse screen from a button
Antonio,
Currently Default Filter for Browse Screen only takes a string - not variables like getElementById (as of version 10.07.12)
eg.
a work around is this..
put this in the JavaScript tab of the button's form.
And put this JavaScript "openB()" in On Double Click field of the button object.
Make sure you remove any form from Form To Launch via Browse , otherwise the form will be opened instead of running the JavaScript function.
Steven
Currently Default Filter for Browse Screen only takes a string - not variables like getElementById (as of version 10.07.12)
eg.
a work around is this..
put this in the JavaScript tab of the button's form.
Code: Select all
function openB(){
/*
filter_string is the value you want to filter on.
(this string works exactly the same as typing a string into the search of a browse screen)
*/
filter_string = document.getElementById('customer_id').value;
form_primary_key = '146008847abeba';
ses_id = document.getElementById('session_id').value;
openBrowse(form_primary_key, filter_string, '', ses_id, '');
}
Make sure you remove any form from Form To Launch via Browse , otherwise the form will be opened instead of running the JavaScript function.
Steven
You do not have the required permissions to view the files attached to this post.
A short post is a good post.
-
- Posts: 5
- Joined: Sat Aug 14, 2010 2:43 pm
- Location: Colorado USA
Re: Filter a browse screen from a button
A long the same line ..
I'm experimenting with the concept of filtering all Form with an ID captured via the Lookup object on the INDEX form. I would need to pass in the ID as a variable and not a static value (as illustrated in the earlier posts).
Any idea on doing this via JS or using nuBuilder functionality.
Thanks
I'm experimenting with the concept of filtering all Form with an ID captured via the Lookup object on the INDEX form. I would need to pass in the ID as a variable and not a static value (as illustrated in the earlier posts).
Any idea on doing this via JS or using nuBuilder functionality.
Thanks
-
- Posts: 5
- Joined: Sat Aug 14, 2010 2:43 pm
- Location: Colorado USA
Re: Filter a browse screen from a button
Further research on this topic identified an opportunity and limitation. I would appreciate any elaboration if you have experience with it
The "Before Browse" box in the "Browse Code" tab in FORMS looks like the spot to apply:
to apply filters to the data I want the end user to view.
But I need access to a Hash Variable populated by a Lookup Field on the INDEX Form to be passed to the "Before Browse". My attempts at this have failed.
Is this approach not possible because Field Hash Variables are not acceeible in "Before Browse" a stated in the Wiki-Appendix/Hash Variable? http://wiki.nubuilder.com/tiki-index.ph ... uilderDocs
If this approach is not possible - are their any alternatives? NOTE: I have limited PHP / JS experience but I can follow examples.
Thanks
The "Before Browse" box in the "Browse Code" tab in FORMS looks like the spot to apply:
Code: Select all
nuRunQuery(“CREATE TABLE #browseTable# SELECT * FROM table WHERE field = '#LookupFieldValueHashVariable#' “);
But I need access to a Hash Variable populated by a Lookup Field on the INDEX Form to be passed to the "Before Browse". My attempts at this have failed.
Is this approach not possible because Field Hash Variables are not acceeible in "Before Browse" a stated in the Wiki-Appendix/Hash Variable? http://wiki.nubuilder.com/tiki-index.ph ... uilderDocs
If this approach is not possible - are their any alternatives? NOTE: I have limited PHP / JS experience but I can follow examples.
Thanks
Re: Filter a browse screen from a button
dataman101,
You can use hash variables in before browse.
To test that it converts the hash variable to the field's value you are wanting use nuDebug()
eg.
This will put the value of tra_delivery_address in the zzsys_trap table so you can check it.
Try putting
“CREATE TABLE #browseTable# SELECT * FROM table WHERE field = '#LookupFieldValueHashVariable#' “
in nuDebug()
Steven
You can use hash variables in before browse.
To test that it converts the hash variable to the field's value you are wanting use nuDebug()
eg.
Code: Select all
nuDebug('#tra_delivery_address#');
Try putting
“CREATE TABLE #browseTable# SELECT * FROM table WHERE field = '#LookupFieldValueHashVariable#' “
in nuDebug()
Steven
A short post is a good post.
-
- Posts: 5
- Joined: Sat Aug 14, 2010 2:43 pm
- Location: Colorado USA
Re: Filter a browse screen from a button
Thanks for the clarification.
I'm testing using the INDEX Form.
I'm using various field types (Lookup, Text, Drop Down) to try to create the HASH variable from the field_name entered but have not been able to see a live variable value when I nuDebug(#field_name#);
Example:
Create a Dropdown populated by "SELECT merchant_id, merchant_name FROM Merchant"
ALL tab 'Field Name' = merchant_id
nuDebug(#merchant_id#); is placed `On Blur` so it can trap the populated value after the field is populated and when focus is moved off the field.
The nuDebug() shows that the HASH variable is not getting populated and only displays the HASH variable name:
This is displayed in a browser window not zzsys_trap.
Thanks
I'm testing using the INDEX Form.
I'm using various field types (Lookup, Text, Drop Down) to try to create the HASH variable from the field_name entered but have not been able to see a live variable value when I nuDebug(#field_name#);
Example:
Create a Dropdown populated by "SELECT merchant_id, merchant_name FROM Merchant"
ALL tab 'Field Name' = merchant_id
nuDebug(#merchant_id#); is placed `On Blur` so it can trap the populated value after the field is populated and when focus is moved off the field.
The nuDebug() shows that the HASH variable is not getting populated and only displays the HASH variable name:
This is displayed in a browser window not zzsys_trap.
Do HASH variables need to be declared for Objects? or is there a special syntax to creating them?Debugging Output
#merchant_id#
Thanks
Re: Filter a browse screen from a button
dataman101,
The way a hash variable works is that before the PHP or SQL code is run there is a string replace done.
Replacing any hash variable with the variable value of the same name.
(If that variable is available - http://wiki.nubuilder.com/tiki-index.ph ... uilderDocs)
Another way to see the variables available is... nuDebug(print_r($arrayOfHashVariables,true));
Hash variables don't need to be declared.
So nuDebug(#field_name#); could become nuDebug(hello world); and would create an error as it has no quotes around it.
I hope this helps.
Steven
The way a hash variable works is that before the PHP or SQL code is run there is a string replace done.
Replacing any hash variable with the variable value of the same name.
(If that variable is available - http://wiki.nubuilder.com/tiki-index.ph ... uilderDocs)
Another way to see the variables available is... nuDebug(print_r($arrayOfHashVariables,true));
Hash variables don't need to be declared.
So nuDebug(#field_name#); could become nuDebug(hello world); and would create an error as it has no quotes around it.
I hope this helps.
Steven
A short post is a good post.