Page 1 of 1
Column
Posted: Fri Nov 04, 2016 12:38 pm
by richmond62
It would be great if one could refer to the columns in tableFields with the word 'column',
as, for instance in:
put "XYZ" into column 3 of line 4 of fld "fTableF1"
Re: Column
Posted: Fri Nov 04, 2016 12:52 pm
by paul@researchware.com
See
http://quality.livecode.com/show_bug.cgi?id=4623
Obviously, if you look at the bug number, this has been a feature request for a long time.
Re: Column
Posted: Fri Nov 04, 2016 2:41 pm
by richmond62
2007: must be very nearly a record.
I wonder why nothing has been done about this when it seems rather an
obvious feature request?
I have added a comment to that Bug report in a desperate attempt to get it noticed by the mothership at last.
Re: Column
Posted: Fri Nov 04, 2016 2:54 pm
by paul@researchware.com
I think one reason it has not been implemented is that it is pretty easy to write your own function to return a numerically indexed column from a tab and return delimited table.
function columnFromTable pTable, pColumnIndex
local tData
set itemDel to tab
repeat for each line tLine of pTable
put item pColumnIndex of tLine & cr after tData
end repeat
if last char of tData is cr then delete last char of tData
return tData
end columnFromTable
It is just not as elegant using:
put columnFromTable(myTable,3) into my3rdColumn
as saying
put column 3 of myTable into my3rdColumn
Re: Column
Posted: Fri Nov 04, 2016 3:14 pm
by richmond62
it is pretty easy to write your own function
Um: well if that were the case Livecode might not have half the functions it has.
Re: Column
Posted: Fri Nov 04, 2016 3:37 pm
by paul@researchware.com
richmond62 wrote:it is pretty easy to write your own function
Um: well if that were the case Livecode might not have half the functions it has.
Not arguing that. Just offering a possible explanation. LC doesn't have the resources to do everything people would like them to, so if I was in their position, choosing between features that can only be implemented in the engine or via externals or widgets vs things that are scriptable, I would weight what I worked on more towards the former.
Personally, I'd love to see a 'column' chunk type that can be used both with delimited data and with arrays. I think for many people, myself included, it would be a highly welcome addition to the language given how much tabular data I work with. That is why I posted the bugzilla link and responded.
Re: Column
Posted: Fri Nov 04, 2016 4:52 pm
by jacque
"Column" is already in use with arrays. Since it's a reserved term, it may not be appropriate for another context.
Re: Column
Posted: Fri Nov 04, 2016 6:13 pm
by paul@researchware.com
jacque wrote:"Column" is already in use with arrays. Since it's a reserved term, it may not be appropriate for another context.
You are referring to the split and combine commands?
The proposal in the bug entry also request using 'column' in the following form
get column 3 of tArray -- return an array of the 3 ordinal key of the second array dimension for each primary key for which a value exists.