Just one of many ways to make an endless loop.
You use break to get out of the loop when you have reached the termination 
condition


________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Tuesday, January 12, 2010 1:22 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Large Spread sheet matrix data


Dennis,

 Thanks for the suggestion.  Once I get the spread sheet data into a table 
accessible

by Rbase,  there are several ways to manipulate.   Your idea being a very good 
one!



However, I must ask what is :



While (0) = (0) then



I try to learn something new every day and this will probably be one for today!

I am not familiar with this syntax.  What is the WHILE statement

interpreting here?



Thanks,

-Bob



----- Original Message -----
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Tuesday, January 12, 2010 12:53:25 PM GMT -06:00 US/Canada Central
Subject: [RBASE-L] - Re: Large Spread sheet matrix data

With the item numbers in the first row, things get really EASY!
Something like this should be all you need, unless you need to get fancy.

Set var vCol# int = 2
Set var vColName TEXT
Set var vItemText TEXT
While (0) = (0) then
  Set var vColName = ('#' + CTXT(.vCol))
  Select &vColName into vItemText From SourceTable Where Count = 1
  If SQLCODE <> 0 then -- no more columns
     Break
  Endif
  Set var vItemNum = &vItemText
  Insert into TargetTable (StoreNum, ItemNum) SELECT #1, &vColName +
  FROM SourceTable WHERE &vColName = 'Y' AND Count > 1

   Set var vCol# = (.vCol# + 1)
endw

Dennis McGrath
________________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Lawrence Lustig
Sent: Tuesday, January 12, 2010 12:40 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Large Spread sheet matrix data

<<
I will look into Karen's suggestion about cursoring the system table.  That 
should
work well.   As long as I Detach the table each time, the column structure 
should
update on the next SAttach.
>>

You can import an XLS of unknown number of columns using

GATEWAY XLS FileName.XLS CREATE TableName

This doesn't require SATTACH and SDETACH (which, for some reason, always make 
me nervous).

With this technique, the items numbers are in the first row of data.  The 
column names are predictable (CELL_A, CELL_B, and so on), so you can "walk" the 
columns yourself (or continue to use the SYS_COLUMNS and SYS_TABLES approach).
--
Larry

Reply via email to