-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetNamedRanges DataType #46
Comments
Can you provide sample code? Thank you.
…________________________________
From: Lutz Scheffler ***@***.***>
Sent: Thursday, May 13, 2021 10:40 AM
To: ggreen86/XLSX-Workbook-Class ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [ggreen86/XLSX-Workbook-Class] GetNamedRanges DataType (#46)
Is there any benefit in using an ARRAY LIST to an empty object instead of simple using a collection? If there is EMPTY then there is COLLECTION - and it would be much more easy to parse?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#46>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGWB33KMQSXBEGOMIKORQLDTNPQHVANCNFSM442VRE7Q>.
|
We are talking about GetNamedRanges I would use a VFP collection instead of array of objects
Now a collection is returned,
where one can query
or use
use FOR EACH and the COUNT property is native. |
Update, short:
if you insist using fieldname for propertyname. (What I would avoid) |
Lutz--
I see the benefit of using the collection class instead of an object. However, in my style of coding I do not use the VFP collection class (I have actually created my own custom collection class that I use in other projects) and the FOR-EACH construct. From what I remember, there is a possible bug in the FOR-EACH so I have not used it. The way the method is currently implemented is similar to how I have done it for other methods so I would prefer to keep it consistent.
You can sub-class the class and then override the method with your own code. Then any updates would be easy to incorporate.
Greg
…________________________________
From: Lutz Scheffler ***@***.***>
Sent: Thursday, May 13, 2021 2:08 PM
To: ggreen86/XLSX-Workbook-Class ***@***.***>
Cc: ggreen86 ***@***.***>; Comment ***@***.***>
Subject: Re: [ggreen86/XLSX-Workbook-Class] GetNamedRanges DataType (#46)
Update, short:
LPARAMETERS tnWB
LOCAL loRanges as Collection ,loRange AS Empty
loRanges = CREATEOBJECT("Collection")
SELECT xl_namerange
SCAN FOR wb = tnWB
SCATTER scope, begcol, begrow, endcol, endrow NAME loRange
ADDPROPERTY(loRange, "Name", ALLTRIM(xl_namerange.rname))
ADDPROPERTY(loRange, "Comment", ALLTRIM(xl_namerange.comment))
ADDPROPERTY(loRange, "SheetId", xl_namerange.sheet)
loRanges.Add(loRange,loRange.Name)
ENDSCAN
RETURN loRanges
if you insist using fieldname for propertyname. (What I would avoid)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#46 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGWB33KW53U37EDLHQEUX6TTNQITFANCNFSM442VRE7Q>.
|
Hi Greg, I was just curious. No critics. It's only so usefull. :) There is no bug in FOR EACH, you simply might do it wrong. (What is common) The correct syntax is: |
I will add a new method GetNamedRangesEx that uses your code.
…________________________________
From: Lutz Scheffler ***@***.***>
Sent: Friday, May 14, 2021 11:09 AM
To: ggreen86/XLSX-Workbook-Class ***@***.***>
Cc: ggreen86 ***@***.***>; Comment ***@***.***>
Subject: Re: [ggreen86/XLSX-Workbook-Class] GetNamedRanges DataType (#46)
Hi Greg,
I was just curious. No critics. It's only so usefull. :)
________________________________
There is no bug in FOR EACH, you simply might do it wrong. (What is common) The correct syntax is:
FOR EACH oElement IN oCollection FOXOBJECT
FOXOBJECT must be provided, or it might crash. I use this without any problem since Tamar provided this insight on a confernce ...
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#46 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGWB33NA7VGUIZJU6C3RSIDTNU4MLANCNFSM442VRE7Q>.
|
Maybe you don't need this. For the first it's a beta anyway. Just expose one behaviour for good. For the second - really I was just curious why you go this way to mimic a collection. I just try to learn by asking questions. |
Closing Issue. Preference in coding styles... |
Is there any benefit in using an ARRAY LIST to an empty object instead of simple using a collection? If there is EMPTY then there is COLLECTION - and it would be much more easy to parse?
The text was updated successfully, but these errors were encountered: