>Hi Brian
>Do you mind if I post this at Clipper...Clipper...Clipper ?
No not at all, in retrospect to this, I have looked at documentation for
Advantage and Comix, who both implement a Scope function, their
documentation is as vague as the SIX documentation, but reading between
the lines from all three products, its working as designed ... not the
best implementation, IMHO but there again I can see the direction used and
understand it.
>Brian Dukes wrote:
>>
>> Having used SIXCDX now quite happily since version 1.5.x, through to
>> version 3.01.00, I have developed my applications and extensively used
>> Sx_SetScope() or SET SCOPE TO in my code.
>>
>> I have just found some interesting behavour with "scopes" that I
>> wasn't aware of and that frightens me a little!
>>
>> OK, lets take a quick psuedo example!
>>
>> set tag to "name"
>> ? sx_setscope(0) // returns NIL
>> Sx_SetScope(0,"BRIAN")
>> ? Sx_SetScope(0) // returns "BRIAN"
>>
>> set tag to "address"
>> ? Sx_SetScope(0) // returns NIL
>> Sx_SetScope(0,"MALVERN)
>> ? Sx_SetScope(0) // returns "MALVERN"
>>
>> set tag to "name"
>> ? Sx_SetScope(0) // returns "BRIAN"
>> Sx_SetScope(0,"")
>> ? Sx_SetScope(0) // returns NIL
>>
>> set tag to "address"
>> ? Sx_SetScope(0) // returns "MALVERN"
>>
>> No where in the SIXCDX documentation does it say that the scope is
>> localised to the current order, and swapping orders will bring into
>> focus a different scope!
>>
>> Not only that but clearing the scope by issuing Sx_SetScope(0,"") and
>> Sx_SetScope(1,"") or by SET SCOPE TO command, is only clearing the
>> scope in the current order ... so when you believe you have cleared
>> the scope on the work-area, and switch orders, you automagically have
>> a scope in force again.
>>
>> OK, take the following code as well :-
>>
>> Sx_SetScope(0,"")
>> cOrgScope := Sx_SetScope(0) // returns NIL
>>
>> Sx_SetScope(0,"FRED")
>> ? Sx_SetScope(0) // retur
>>
>> Sx_SetScope(0,cOrgScope) // restore origi
>> ? Sx_SetScope(0) // retur
>>
>> Because Sx_SetScope returns NIL if no scope is in force, cOrgScope
>> now contains NIL ... if Sx_setscope is called with no second
>> parameter then sx_setscope will just return the current scope setting;
>> Obviously they are checking if the second parameter is NIL, if so just
>> returning the value .... So a function that will save the value of
>> scope mess around under a different scope and then restore scope to
>> its original value, is not gonna work unless it looks summat like :-
>>
>> Sx_SetScope(0,if(cOrgScope == NIL,"",cOrgScope))
>>
>> I think whats clear from the message above, is that I had assumed that
>> you only had ONE scope per work area, as opposed to having one scope
>> per index order!! I can now see a lot of work writing a
>> Sx_SetScope() replacement, which will run through the other orders and
>> clear their scope before setting scope on the current order. And
>> correcting the SET SCOPE TO problem in the same way; and correcting
>> the NIL second parameter problem!!
>>
>> Thanks SuccessWare .... PLEASE can you either DOCUMENT this or FIX
>> IT!!
>>
>> Brian.
-----------------------------------------------------------
Brian Dukes
-----------------------------------------------------------
No comments:
Post a Comment