|
Opens an SQL VIEW on the NAMEed database based on the results of the query string.
Attributes
ExamplesThis examples Opens a MySQL database, Opens a view that selects a particular table and record based on a product_code. Notice: The records are accessed using the VIEW name (e.g. <MvOPENVIEW VIEW="Products"...) instead of the name used in the MvOpen Tag. (e.g. <MvOPEN NAME = "Merchant"... ). Example:
<MvOPEN NAME = "Merchant" DATABASE = "mydatabasefile@localhost" TYPE = "mysql"
USERNAME = "{ l.username }" PASSWORD = "{ l.password }">
<MvASSIGN NAME = "l.query"
VALUE = "{ 'SELECT * FROM Products WHERE code = ?' }">
<MvOPENVIEW NAME = "Merchant" VIEW = "Products" QUERY = "{ l.query }" FIELDS = "l.product_code">
<MvEVAL EXPR="{ 'Product Code: ' $ Products.d.code $ ' <br>' }">
<MvEVAL EXPR="{ 'Product Name: ' $ Products.d.name $ ' <br>' }">
In this example all active products are displayed in code order. Example:
<MvASSIGN NAME = "l.query"
VALUE = "{ 'SELECT * FROM Products WHERE active = 1 ORDER BY code ASC' }">
<MvOPENVIEW NAME = "Merchant" VIEW = "Products" QUERY = "{ l.query }">
<MvWHILE EXPR = "{ NOT Products.d.EOF }">
<MvASSIGN NAME = "l.product_count" VALUE = "{ l.product_count + 1 }">
<MvEVAL EXPR="{ 'Product Code: ' $ Products.d.code $ ', ' }">
<MvEVAL EXPR="{ 'Product Name: ' $ Products.d.name $ ' <br>' }">
<MvSKIP NAME = "Merchant" VIEW = "Products" ROWS = 1>
</MvWHILE>
|