How to use variables in the Database Query Builder?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to use variables in the Database Query Builder?
I would like to use a variable inside of a "HAVING name = " in my SQL statment using the Database Query Builder... anyway to do this?
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Hi Paul,
You can't use variables in the database query builder, but there is an undocumented command 'revSetSQLOfQuery' that you can use for this:
where "orderdetails" is the name of the query that you created using the database query builder.
To learn more about the database query system, you can review the 'revDatabase' frontscript:
- open the Message Box
- use the third button from the right to switch to the Front Scripts panel
- tick the checkbox 'Show Revolution UI Front Scripts'
- doubleclick the line 'revDatabase' to review its script
Watch and learn, but make sure not to modify anything
With some clever use of the undocumented database query commands and functions, you can actually get a pretty complete master-detail form working in very little time.
Hope this helped,
Jan Schenkel.
You can't use variables in the database query builder, but there is an undocumented command 'revSetSQLOfQuery' that you can use for this:
Code: Select all
on mouseUp
revSetSQLOfQuery "orderdetails", "SELECT * FROM orderdetails WHERE orderid =" && (field "OrderID")
end mouseUp
To learn more about the database query system, you can review the 'revDatabase' frontscript:
- open the Message Box
- use the third button from the right to switch to the Front Scripts panel
- tick the checkbox 'Show Revolution UI Front Scripts'
- doubleclick the line 'revDatabase' to review its script
Watch and learn, but make sure not to modify anything

With some clever use of the undocumented database query commands and functions, you can actually get a pretty complete master-detail form working in very little time.
Hope this helped,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com