Question:
How can I change the Query in E3Browser for another pre-existing Query?
Solution:
To do so, you must change E3Browser‘s SourceQuery property, and then hit Requery() method. If the two Queries have different structures, you will also need to use RetrieveE3QueryFields() method.
For example:
set browser = Screen.Item("E3Browser1")
browser.SourceQuery = "Query2"
browser.RetrieveE3QueryFields()
browser.Requery()
If there are any filters, you must use SetVariableValue() method after the Query has been defined. For example, the following script can be used in a ComboBox’s Change event listing all available queries:
dim inidate, findate, query
inidate = Screen.Item("Text1").Value
findate = Screen.Item("Text2").Value
set browser = Screen.Item("E3Browser1")
browser.SourceQuery = Value
set query = browser.Item(Value)
query.SetVariableValue "Start", inidate
query.SetVariableValue "End", findate
browser.RetrieveE3QueryFields()
browser.Requery()
To see all existing queries listed on the ComboBox, just sweep items from E3Browser by adding their names. For example:
Clear()
for each obj in Screen.Item("E3Browser1")
AddItem obj.Name
next