On Fri, Apr 21, 2017 at 2:04 AM, AndyHC andy@hawthorncottage.com wrote:
On 21-Apr-2017 5:17 AM, Ted Roche wrote:
Consider standardizing the alias, for example,
USE (aliasstr) alias TARGET AGAIN IN 0
Now, the report can refer to Target.fieldname with no need to wrap it in a function.
Elegant, but am I missing something? - why not just:
USE (aliasstr) can't the report now refer to fieldname ?
Sure, if there was only a single table in the report, which is what I'd prefer. Although, it's more likely SELECT (aliasstr) as Gene has already opened the report somewhere else.
I suggest a USE AGAIN because I'm guessing it's already open, and assign an ALIAS to the new work area because it's likely with the variable name "aliasstr" it may already have been assigned an alias other than its tablename, which Gene would want to retain. This way, at nearly no cost, you can
USE (aliasstr) AGAIN ALIAS Target IN 0
and refer to Target.fieldname in the report and then
USE IN Target
to close the work area, leaving the original 'aliasstr' work area to do with as Gene's framework decides. Simple, temporary, and clean up after.
As a bonus, if you create the cursor in a different way, say some mock data for testing, you can use the same alias and run your tests.