Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Submitting comma delimited data
Message
From
13/05/2011 09:23:10
 
 
To
13/05/2011 09:16:17
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01510319
Message ID:
01510573
Views:
56
And building from that I just solved my problem. I double checked the GETWORDCOUNT function and saw that leaving it like this:
NumberRecords = GETWORDCOUNT(m.bnin)
meant that it was looking for something delimited by a space, hence why I tried using a space and not a comma. Then I changed it to this:
NumberRecords = GETWORDCOUNT(m.bnin, ",")
and watched it pick both record numbers up while debugging. I checked my test folder and both Excel files were there. You may have mentioned this in an earlier post but I may have misunderstood.

Thanks for all your help, I really appreciate it. Likewise to everyone else who gave me tips.



>Something else somewhat interesting, if I don't delimit the input with commas and just use a space, I get two messageboxes popping up like it reads both numbers, except the second popup is all zeroes and I get an error that it can't find the record (since it doesn't exist).
>
>
>>>I'll just post the whole function, I didn't include some parts because I didn't think they played a part in what I was trying to do, but obviously I don't know what I'm doing so maybe this was the problem all along.
>>>
>>>
FUNCTION ApprovalPrintout
>>>	SET STEP ON 
>>>	m.bnin = ""
>>>	m.bn = ""
>>>	m.ty = ""
>>>	*Set variables to input from HTML page
>>>	m.bnin = ALLTRIM(TRANSFORM(Request.Form("bn")))
>>>	m.ty = ALLTRIM(Request.Form("btntype"))
>>>	m.msg = ""
>>>	
>>>
>>>		IF EMPTY(m.bnin)
>>>			IF EMPTY(m.ty)
>>>			m.msg="You Need To Enter A Batch Number"
>>>		ELSE
>>>			m.msg="Shouldnt Get this"		
>>>		ENDIF
>>>		
>>>		
>>>	ELSE
>>>
>>>		
>>>			NumberRecords = GETWORDCOUNT(m.bnin)
>>>				FOR i = 1 TO NumberRecords
>>>					m.bn = PADL(GetWordNum(m.bnin, i, ","),7,"0")				
>>>   			
>>>			*Opens the DBF file in the "key" folder, appends "A" and adds the user input as batch number
>>>			OpenTable(goWCServer.oConfig.oTask.cBTSPath+[key\A]+m.bn,[AppExp])
>>>			
>>>			*Select columns from table above, name them for Excel headers
>>>			SELECT 	bn as [BatchNum],;
>>>					pk as [RecNo],;
>>>					"" as [Approved],;
>>>					shdt as [ShipDate],;
>>>					canm as [Carrier],;
>>>					prno as [Pro],;
>>>					blno as [BOL],;
>>>					shnm as [Shipper],;
>>>					ozp as [OZip],;
>>>					conm as [Consignee],;
>>>					dzp as [DZip],;
>>>					wtttl as [Weight],;
>>>					"" as [ReWeigh],;
>>>					"" as [Notes],;
>>>					accd1 as [Acc1],;
>>>					acamt1 as [Amt1],;
>>>					accd2 as [Acc2],;
>>>					acamt2 as [Amt2],;
>>>					accd3 as [Acc3],;
>>>					acamt3 as [Amt3];
>>>			FROM AppExp; 
>>>			into cursor ApprovalA
>>>			
>>>			SELECT ApprovalA
>>>
>>>*Copy data from cursor to Excel file
>>>COPY TO ("C:\test\"+[bn]+m.bn+[T2.xls]) 
>>>
>>>m.msg=[File Exported to C:\test\bn]+m.bn+[T2.xls] + TRANSFORM(NumberRecords)
>>>ENDFOR
>>>			CloseTable("AppExp")
>>>
>>>
>>>
>>>	ENDIF
>>>	
>>>	Response.ExpandTemplate(goWCServer.oConfig.oTask.cBTSHTMPath+"ApprovalPrintout.htm")				
>>>		
>>>	
>>>ENDFUNC
>>>
>>>I stuck the cursor back in temporarily while I was testing some things, and I tried putting the ENDFOR right after the COPYTO, after the CLOSETABLE, and where it currently is in the code above.
>>
>>
>>Just wondering, how are you telling that it has only gone through the loop once? If it is based on your m.msg variable, then that will always report the last one exported, you should change that line to this:
>>
>>m.msg= m.msg + CHR(13) + CHR(10) + [File Exported to C:\test\bn]+m.bn+[T2.xls] + TRANSFORM(NumberRecords)
>>
>>I'm shutting down for the day. I hope you work it out, if not I'll be back tomorrow morning for a little while.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform