Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to print multi-record labels
Message
 
 
To
05/03/2002 10:46:32
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00628439
Message ID:
00629116
Views:
13
This message has been marked as the solution to the initial question of the thread.
You can create new cursor with one record per id and two fileds: id and item list memo. See code below.
Select 0
CREATE CURSOR crsMemo (ItemList M)
APPEND BLANK 
Select 0
USE test1
SELECT id, crsMemo.Itemlist ;
	FROM test1, crsMemo ;
	GROUP BY 1 ;
	INTO CURSOR crsRep READWRITE 
REPLACE ALL ItemList WITH CreateItemList(Id)
RETURN

FUNCTION CreateItemList(tcId)
LOCAL lcItemList, lcCrLf, laList[1], i
SELECT Item, Total ;
	FROM test1 ;
	WHERE Id = tcId ;
	INTO ARRAY laList
lcCrLf = Chr(13)+ Chr(10)
lcItemList = ""	
FOR i=1 TO ALEN(laList,1)
	lcItemList = lcItemList + lcCrLf + Padr(laList[i,1],32) + Str(laList[i,2],3)
ENDFOR
RETURN Substr(lcItemList,3)
Make sure that you use non-proportional font for ItemList field on the label.
Here's the structure of test1 table I used for testing
Field  Field Name                   Type                Width    
    1  ID              Character               3  
    2  ITEM            Character              10  
    3  TOTAL           Numeric                 3  
>Example:
>I used a SELECT statement to get this cursor:
>ID,item,total
>245,brush,5
>245,pen,10
>321,pen,40
>321,glass,15
>321,ruler,3
>321,phone,25
>etc.
>Each ID has a few items/records.
>
>I'd like to print labels (about 2" X 2", 3 accross) with id printed once, and all items belonging to that id:
>ID= 245
>Brush    5
>Pen     10
>and another label will be:
>ID=321
>pen     40
>glass   15
>ruler    3
>phone   25
>etc.
>
>Can this be done with the label designer?
>How?
>Any help is greatly appreciated. THANKS ALL!
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform