From a reference variable, is it a possible to get other properties of the referenced field besides something like numeric, isstring?
AnyRef &= SqlTableField
What is external name of AnyRef?
Not sure about the external name, but you can get at other stuff, such as data type and actual data address, with my “private” class. Did you try examining NAME(AnyRef) after assignment?
Greetings -
It could be possible, I just have never done a reference variable like that. I have used these techniques in group and queue quite a bit. You will have to use the TUFO interface, which is not documented by SV. It has been reverse discovered by users and mostly used in the debug trace that uses debug view++
You can find some examples of the techniques documented and used in some of the current trace debuggers. The Ultimate Debug (John Hickey) or the Debuger (Mark Goldberg).
If it is a referenced variable, you will have to do a bit of more work. You might need to use the NAME attribute to put the information in the name field, and then parse it out to find out what you need.
It is a field, so if you have an FEQ on a screen, you can use the internal call to get the reference name, which can give you the name of the USE() variable. The TUFO interface and NAME() attributes will give you anything else that you might need. Look at Mr. Bruce’s suggested external NAME() standard document. A Proposed Convention for the Extended use of the Name Attribute The Clarion Live webinar episode describing this is at https://www.clarionlive.com/BrowseEpisodes/ww!528
You might need a class to parse the NAME attributes, and there is an example of such a class in the RYB free templates at GitHub - RobertArtigas/RYB: Run Your Business (RYB) template collection.
Good luck with it.
Regards
Roberto Artigas
Greetings -
There is also Mr. Jeff’s class above, which might make things easier.
I have not tried his class yet. I do have his class forked and in my GitHub, though.
It is in my TODO things bucket.
Regards,
Roberto Artigas
Both {PROP:Name} and {PROP:Label} return an empty string.
I do have a work around to accomplish what I need.
I thought it would be nice to generate a browse filter (SQL) using properties on the reference variable - something like:
AnyRef{PROP:Name} = AnyRef (add quotes as needed)
Procedure overloading can be used to work out data types, dont even need TUFO for that.
Edit a few days later of testing it for real.
Ignore the above it doesnt work with procedure overloading.
IE
Someproc procedure
Loc:Cstring(‘cstring’)
Loc:String(‘string’)
Code
TestDataType(loc:cstring)
TestDataType(loc:string)
TestDataType procedure (*? pDT)
Map
Returndt procedure(*cstring pdt)
Returndt procedure(string pdt)
Returndt procedure(? Pdt)
End
Code
Case upper(returndt(pdt))
Of ‘CSTRING’
!
Of ‘STRING’
!
Of ‘ANY’
! Always calls this one
…
In assembler you can see the
Call dword [c60runx.dll:cla$Cla$PushString]
And the stack heap call
So its defaulting to the long, decimal, string and real as described in the docs for untyped value params even though its an untyped address param.
But you have to supply a proc(*? p) because the compiler complains which means there are some situs it csnt do the polymorphic procedure overloading.
Why does this website mess up my phones keyboard?
Maybe it’s simplest to get the WHO() at the same time as you get the &= WHAT()? AFAIK, the original name isn’t part of the stuff that the reference inherits.
That is essentially what I concluded. Both get passed - one as a string, the other as a reference.
Except WHO again proves to be crap. It will return Pre:FieldName or something like mysqlcolname | READONLY depending upon file definition. Have been through all this before. Not to be relied upon.
Well, for labels that have extra attributes, parse them out and move on, or don’t do nuthin’.
Sometimes you could get no label anyway.
But if you do get a label, now you have something to use for the thing you need it for.
If you don’t, then don’t try to do the thing that would have needed it.
Better than nothing, but not as good as awesome.
I have something that works, but WHO is never to be sufficiently cursed.
Greetings -
Could you please show us the code you decided to do to finally solve the issue?
Thank you. If it is not going to be a problem, or course.
Regards,
Roberto Artigas
Roberto - a little context might help.
For any column in a browse that has header sorting, a popup item gets created as a check item showing the current value of the mouse down column. Clicking the popup item, immediately filters the browse by the current row value of that column.
The need then is to pass the selected column field as a reference and return an appropriate string to use as the filter. Because the data is PG, as you likely know, the desired filter might need to be SQL (ie ILIKE) or more simply a string evaluated by the Clarion ODBC driver (ie Pre:FieldName=FieldValue).
My hope had been to get everything from the passed reference. Instead, I had to include the name of the field as a string. It works, but is a maintenance risk because field name changes would not be caught by the compiler. My preference is to have such class things be more generalized.