Well, the generic include file I'm trying to make is for the purpose of sorting a browser when you click a column. I've had it working perfectly fine for months (see my
original thread), until a colleague pointed out a problem.
I'm using the AppBuilder in 9.1E. We have some dialog boxes in the form of a lookup, and the SmartBrowsers inside use filters in Xftr Advanced Query Options (XAQO) to pass the search criteria around. So an example of a query like this could be:
FOR EACH Genre WHERE Genre.Description BEGINS Input NO-LOCK
where 'Input' is listed in the XAQO.
I create a dynamic query in the include file to change the reference to 'Input' into its actual value (otherwise the QUERY-PREPARE statement fails...see other thread).
The act of setting 'Input' in XAQO stores it as an attribute of the procedure, using set-attribute-list. When the sort is performed on the browser, procedure adm-open-query-cases defines a local variable to obtain the value of 'Input' using get-attribute. As such, it is scoped to the local procedure, and the START-SEARCH trigger of the browser doesn't know anything about its value. No problem, you say, I can just use get-attribute again, and store the value in a local variable exactly the same as in adm-open-query-cases.
Where the problem lies is that, because I'm trying to encapsulate everything in a generic include file, and because I need to convert all variable references within the query into their actual current values, means that the query could just as likely refer to a variable defined in Definitions/Main Block and set anywhere within the entire procedure. Using get-attribute will fail because it won't have been set like that.
So I have to cater for both scenarios, where a variable reference in the query could have come from XAQO or been defined manually. I need to define a local variable in START-SEARCH if the variable came from XAQO, but I don't want to if it was defined globally for the procedure (because its value would be overwritten).
This all sounds very confusing, I'm sure
Let me know if you understand what I'm on about, or if you would like proper code examples.