Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Widen number of records by field
Message
From
03/11/2009 06:57:55
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01432871
Message ID:
01432880
Views:
58
Hi Sergey,

Thanks for the help.

I need
MAX(iChair) 
right ?

Your solution returns something like 2* (number non deleted records) with unpredictable numbers. (As soon as something is deleted).

and even for a cursor with only undeleted records it would fail for
CREATE CURSOR curTable (cTableNumber c(1), iChair I)
INSERT INTO curTable VALUES ('4',6)
Agnes

>Hi Agnes,
>
>Try
>
>SELECT cTableNumber, cTableNumber + "." + TRANSFORM(sn) AS cChairNumber ;
>FROM curTable ;
>	JOIN ( ;
>			SELECT RECNO() AS sn FROM curTable ;
>			UNION ALL ;
>			SELECT RECNO() + RECCOUNT() AS sn FROM curTable ) crsNumbers ON curTable.iChair >= crsNumbers.sn
>
>
>The inner select with UNION creates a Numbers table. You can create it any way that works for you. Just make sure that it hold sequential whole numbers with max value not less than # of chairs. For example
>
>* Create numbers table
>lnMaxChairs = 8
>CREATE CURSOR crsNumbers (sn i)
>FOR i=1 TO lnMaxChairs
>	INSERT INTO crsNumbers VALUES(i)
>ENDFOR
>	
>SELECT cTableNumber, cTableNumber + "." + TRANSFORM(sn) AS cChairNumber ;
>FROM curTable ;
>	JOIN crsNumbers ON curTable.iChair >= crsNumbers.sn
>
>
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform