Page 1 of 1
Button passes js var to SQL query to browse filtered data
Posted: Tue May 12, 2015 1:22 am
by Ralcala
Hi fellas iam a nbpro newbie and right now iam stuck i just can make SQL statement in General Tab queries for some thing like this
SELECT * from mytable WHERE my field = #jsvar#
its for a Menu of buttons and every button browses different queries
alternate ways to make same task welcome any ideas and advises
Thank you and what a state of art software you developed nbpro team really amazing.
Re: Button passes js var to SQL query to browse filtered dat
Posted: Tue May 12, 2015 4:19 am
by admin
Ralcala,
I'm not sure what you are asking but unless your field is a number you will need to put quotes around the hash variable in your sql eg.
Code: Select all
SELECT * from mytable WHERE my field = '#jsvar#'
Steven
Re: Button passes js var to SQL query to browse filtered dat
Posted: Tue May 12, 2015 4:48 am
by Ralcala
Thanks Steven for your quick replay
Here is the process
1.- A Menu of 10 buttons every button have a event on click a JavaScript var to store two digit
2.- When the form loads previously modified SQL Statment on General Tab to
SELECT * mytable WHERE myfield = a global var stored with a two digit previously on click event
3.- Browse window shows only data selected.
my question is what is the code for js in the event on click to store two digit on a global variable that where accessible by all nbpro environment.
Thanks again Steven
Re: Button passes js var to SQL query to browse filtered dat
Posted: Fri May 15, 2015 5:25 am
by admin
Ralcala,
Use hash variables.
If you have a field on your Form called two_digits, your Browse Form can use this in its SQL eg.
Code: Select all
SELECT * FROM inventory WHERE inv_code = '#two_digits#'
http://wiki.nubuilder.net/index.php/Hash_Variables
Steven