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

--- RBASE-L
=======================3D=======================3
D=
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]

(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
=======================3D=======================3
D=
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
=======================3D=======================3
D=
TO UNSUBSCRIBE:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
=======================3D=======================3
D=
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body,
place any
text to search for.
=======================3D=======================3
D=


Reply via email to