tableField . . . refering to columns

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

tableField . . . refering to columns

Richmond Mathewson-2
So: I have a "^" delimited textFile (.CSV) that I imported into a
conventional textField ("fPRE")
and then tried to do this:

on mouseUp
    set the itemDelimiter to "^"
    put line 1 of fld "fPRE" into PREE1
    put item 1 of PREE1 into column 1 of line 1 of fld "fTF"
end mouseUp

line 1 if fld "fPRE" contains this "2^45^9^1113"

I wonder why this throws a "bluey":

button "Button": compilation error at line 4 (Handler: bad command) near
"1", char 30

OR . . . to put things another way: How does one refer to columns in a
tableField?

Richmond.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

Roger Eller
A regular table field is TAB delimited.  Also, refer to your "column" as
"item".

Try this:

on mouseUp
   set the itemDelimiter to "^"
   put line 1 of fld "fPRE" into PREE1
   set the itemDeliniter to TAB
   put item 1 of PREE1 into item 1 of line 1 of fld "fTF"
end mouseUp

~Roger


On Thu, Nov 3, 2016 at 2:54 PM, Richmond <[hidden email]>
wrote:

> So: I have a "^" delimited textFile (.CSV) that I imported into a
> conventional textField ("fPRE")
> and then tried to do this:
>
> on mouseUp
>    set the itemDelimiter to "^"
>    put line 1 of fld "fPRE" into PREE1
>    put item 1 of PREE1 into column 1 of line 1 of fld "fTF"
> end mouseUp
>
> line 1 if fld "fPRE" contains this "2^45^9^1113"
>
> I wonder why this throws a "bluey":
>
> button "Button": compilation error at line 4 (Handler: bad command) near
> "1", char 30
>
> OR . . . to put things another way: How does one refer to columns in a
> tableField?
>
> Richmond.
>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

Roger Eller
Correction:  You can't use 2 different item delimiters in the same command.

on mouseUp
   set the itemDelimiter to "^"
   put line 1 of fld "fPRE" into PREE1
   put item 1 of PREE1 into tJustTheItem
   set the itemDeliniter to TAB
   put tJustTheItem into item 1 of line 1 of fld "fTF"
end mouseUp




Roger Eller
Graphics Systems Analyst

803 North Maple Street P: 864.967.1625
Simpsonville, SC 29681 C: 864.908.0337
SealedAir.com <http://www.sealedair.com/> [hidden email]
<[hidden email]>



On Thu, Nov 3, 2016 at 3:11 PM, Roger Eller <[hidden email]>
wrote:

> A regular table field is TAB delimited.  Also, refer to your "column" as
> "item".
>
> Try this:
>
> on mouseUp
>    set the itemDelimiter to "^"
>    put line 1 of fld "fPRE" into PREE1
>    set the itemDeliniter to TAB
>    put item 1 of PREE1 into item 1 of line 1 of fld "fTF"
> end mouseUp
>
> ~Roger
>
>
> On Thu, Nov 3, 2016 at 2:54 PM, Richmond <[hidden email]>
> wrote:
>
>> So: I have a "^" delimited textFile (.CSV) that I imported into a
>> conventional textField ("fPRE")
>> and then tried to do this:
>>
>> on mouseUp
>>    set the itemDelimiter to "^"
>>    put line 1 of fld "fPRE" into PREE1
>>    put item 1 of PREE1 into column 1 of line 1 of fld "fTF"
>> end mouseUp
>>
>> line 1 if fld "fPRE" contains this "2^45^9^1113"
>>
>> I wonder why this throws a "bluey":
>>
>> button "Button": compilation error at line 4 (Handler: bad command) near
>> "1", char 30
>>
>> OR . . . to put things another way: How does one refer to columns in a
>> tableField?
>>
>> Richmond.
>>
>>
>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

Randy Hengst
In reply to this post by Richmond Mathewson-2
What is “column 1” in your mouseUp handler? As far as I know that doesn’t refer to a reserved word in LC… so that will cause a bump in the code.

What do you get if you replace that line of code with:
answer item 1 of PREE1

be well,
randy



> On Nov 3, 2016, at 1:54 PM, Richmond <[hidden email]> wrote:
>
> So: I have a "^" delimited textFile (.CSV) that I imported into a conventional textField ("fPRE")
> and then tried to do this:
>
> on mouseUp
>   set the itemDelimiter to "^"
>   put line 1 of fld "fPRE" into PREE1
>   put item 1 of PREE1 into column 1 of line 1 of fld "fTF"
> end mouseUp
>
> line 1 if fld "fPRE" contains this "2^45^9^1113"
>
> I wonder why this throws a "bluey":
>
> button "Button": compilation error at line 4 (Handler: bad command) near "1", char 30
>
> OR . . . to put things another way: How does one refer to columns in a tableField?
>
> Richmond.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

Bob Sneidar-2
Did explicit variables get turned on? I have had my explicit variables turned on without my assistance 3 times in the last 2 days. LC 8.1.1

Bob S


> On Nov 3, 2016, at 13:14 , Randy Hengst <[hidden email]> wrote:
>
> What is “column 1” in your mouseUp handler? As far as I know that doesn’t refer to a reserved word in LC… so that will cause a bump in the code.
>
> What do you get if you replace that line of code with:
> answer item 1 of PREE1
>
> be well,
> randy
>
>
>
>> On Nov 3, 2016, at 1:54 PM, Richmond <[hidden email]> wrote:
>>
>> So: I have a "^" delimited textFile (.CSV) that I imported into a conventional textField ("fPRE")
>> and then tried to do this:
>>
>> on mouseUp
>>  set the itemDelimiter to "^"
>>  put line 1 of fld "fPRE" into PREE1
>>  put item 1 of PREE1 into column 1 of line 1 of fld "fTF"
>> end mouseUp
>>
>> line 1 if fld "fPRE" contains this "2^45^9^1113"
>>
>> I wonder why this throws a "bluey":
>>
>> button "Button": compilation error at line 4 (Handler: bad command) near "1", char 30
>>
>> OR . . . to put things another way: How does one refer to columns in a tableField?
>>
>> Richmond.
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

Bob Sneidar-2
In reply to this post by Randy Hengst
Oh crap yeah I don't think a field has a "column" property. Boy it would be nice if it did!

Bob S


On Nov 3, 2016, at 13:14 , Randy Hengst <[hidden email]<mailto:[hidden email]>> wrote:

 put item 1 of PREE1 into column 1 of line 1 of fld "fTF"
end mouseUp

line 1 if fld "fPRE" contains this "2^45^9^1113"

I wonder why this throws a "bluey":

button "Button": compilation error at line 4 (Handler: bad command) near "1", char 30

OR . . . to put things another way: How does one refer to columns in a tableField?

Richmond.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

dunbarxx
In reply to this post by Richmond Mathewson-2
Richmond.

Is "column" a native word in, what I assume you are using, v8?

It is not in v6.

Craig
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

Mike Bonner
In reply to this post by Bob Sneidar-2
The why has been covered.. no "column" delimiter, and the fact that.. if it
were to actually work, putting item 1 of your sample data into item 1 of
the field should put the item separated by the specified item delimiter..
so there would be no change. (unless as above you use 2 delimiters

Meaning if you did this..

put "1^2^3^4" into tdata
set the itemdel to "^"
repeat with i = 1 to the number of items in tdata
put item i of tdata into item i of tdata
end repeat
put tdata

You get out exactly what you put in.  1^2^3^4

Its interesting to me that the itemdel can't be changed on the fly to do
this..  Well, it will but you have to have 2 separate containers because
the number of items fluctuates based on chosen delimiter as things are
processed. The following works..

put "1^2^3^4" into tdata
set the itemdel to "^"
repeat with i = 1 to the number of items in tdata
   put item i of tdata into tTempitem
   set the itemdel to tab
   put tTempitem into item i of tdata2 -- separate container, separate item
counts
   set the itemdel to "^"
end repeat
put tdata2

But it still begs the question why one wouldn't just-- replace "^" with tab
in field "whatever"

On Thu, Nov 3, 2016 at 2:43 PM, Bob Sneidar <[hidden email]>
wrote:

> Oh crap yeah I don't think a field has a "column" property. Boy it would
> be nice if it did!
>
> Bob S
>
>
> On Nov 3, 2016, at 13:14 , Randy Hengst <[hidden email]<mailto:iow
> [hidden email]>> wrote:
>
>  put item 1 of PREE1 into column 1 of line 1 of fld "fTF"
> end mouseUp
>
> line 1 if fld "fPRE" contains this "2^45^9^1113"
>
> I wonder why this throws a "bluey":
>
> button "Button": compilation error at line 4 (Handler: bad command) near
> "1", char 30
>
> OR . . . to put things another way: How does one refer to columns in a
> tableField?
>
> Richmond.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

Richmond Mathewson-2
In reply to this post by Bob Sneidar-2
http://forums.livecode.com/viewtopic.php?f=6&t=28257

Feature request.

Richmond.

On 3.11.2016 22:43, Bob Sneidar wrote:

> Oh crap yeah I don't think a field has a "column" property. Boy it would be nice if it did!
>
> Bob S
>
>
> On Nov 3, 2016, at 13:14 , Randy Hengst <[hidden email]<mailto:[hidden email]>> wrote:
>
>   put item 1 of PREE1 into column 1 of line 1 of fld "fTF"
> end mouseUp
>
> line 1 if fld "fPRE" contains this "2^45^9^1113"
>
> I wonder why this throws a "bluey":
>
> button "Button": compilation error at line 4 (Handler: bad command) near "1", char 30
>
> OR . . . to put things another way: How does one refer to columns in a tableField?
>
> Richmond.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

pmbrig
In reply to this post by Roger Eller
On Nov 3, 2016, at 3:15 PM, Roger Eller <[hidden email]> wrote:
>
> on mouseUp
>   set the itemDelimiter to "^"
>   put line 1 of fld "fPRE" into PREE1
>   put item 1 of PREE1 into tJustTheItem
>   set the itemDeliniter to TAB
>   put tJustTheItem into item 1 of line 1 of fld "fTF"
> end mouseUp

It’s pretty easy to do this kind of thing with some utility handlers. I have a collection of them to enable me to process text in various ways, including:

getItem(pContainer, pIndex, pDelim)
getNestedItem()
getColumns(pData, pColNbrs, pDelim)
deleteColumns(pData, pColNbrs, pDelim)
getGridCell()
replaceItem pList, pItemNbr, pNewItem, pDelim

etc. This allows text processing (which I do a lot of) completely within LC and turns script-it-anew-each-time chunks of code into one-liner calls. Most of these are available in the Master Library, I believe. Or email me if you’re interested.

— Peter

Peter M. Brigham
[hidden email]



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: tableField . . . refering to columns

Bob Sneidar-2
Agreed Peter. The beauty of LC is the ability to piece together things to create a more functional whole. At some point we are just asking the devs to do all our coding for us.

Bob S


> On Nov 4, 2016, at 10:05 , Peter M.Brigham <[hidden email]> wrote:
>
> On Nov 3, 2016, at 3:15 PM, Roger Eller <[hidden email]> wrote:
>>
>> on mouseUp
>>  set the itemDelimiter to "^"
>>  put line 1 of fld "fPRE" into PREE1
>>  put item 1 of PREE1 into tJustTheItem
>>  set the itemDeliniter to TAB
>>  put tJustTheItem into item 1 of line 1 of fld "fTF"
>> end mouseUp
>
> It’s pretty easy to do this kind of thing with some utility handlers. I have a collection of them to enable me to process text in various ways, including:
>
> getItem(pContainer, pIndex, pDelim)
> getNestedItem()
> getColumns(pData, pColNbrs, pDelim)
> deleteColumns(pData, pColNbrs, pDelim)
> getGridCell()
> replaceItem pList, pItemNbr, pNewItem, pDelim
>
> etc. This allows text processing (which I do a lot of) completely within LC and turns script-it-anew-each-time chunks of code into one-liner calls. Most of these are available in the Master Library, I believe. Or email me if you’re interested.
>
> — Peter
>
> Peter M. Brigham
> [hidden email]
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode