Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Submitting comma delimited data
Message
From
11/05/2011 15:24:09
 
 
To
11/05/2011 15:21:59
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01510319
Message ID:
01510373
Views:
43
>>>>>>>>>>
>>>>>>>>>>*Copy data from cursor to Excel file
>>>>>>>>>>COPY TO ("C:\test\"+[bn]+m.bn+[T2.xls])
>>>>>>>>>
>>>>>>>>>you've got the endfor in the wrong place, it should be after the copy to
>>>>>>>>
>>>>>>>>
>>>>>>>>I just tried that too and get the same result... I don't get it.
>>>>>>>
>>>>>>>
>>>>>>>For debugging step through and see what NumberOfRecords is
>>>>>>
>>>>>>
>>>>>>I didn't go through the debugger, but I did set NumberOfRecords to a messagebox and it shows as "1" after I hit export. It's just not seeing any other input.
>>>>>>
>>>>>>I don't know if this means anything, but I tried kind of combining your code with part of what Tore suggested:
>>>>>>
>>>>>>
NumberRecords = GETWORDCOUNT(m.bnin, ',')
>>>>>>
>>>>>>I added the ',' there and then it ignores the first number I type in and exports the second one after the comma. Basically it exported whatever the last record was, I tried three numbers at the same time and it only exported the third. I don't know if that's of any use for figuring this out but it's something different I noticed.
>>>>>
>>>>>what does m.bnin look like?
>>>>>
>>>>>If I do this in my command window I get 3 displayed:
>>>>>
>>>>>?GETWORDcount("1,2,3",",")
>>>>>
>>>>>which indicates 3 words have been found so that code should be OK
>>>>
>>>>Do you mean what do the numbers I'm trying to enter look like, or what is the program actually seeing? Probably what the program is seeing, I'm not sure how to debug it the way it's set up, there is a ton of code for a bunch of other pages in here and this is just one function in the whole thing. I'll see if I can figure it out.
>>>
>>>You need to work out what the program is seeing. Set a breakpoint on the line of code where you need the program to stop, by double clicking in the grey border of the program to the left of the line (a red dot will appear and the debug window will open) and then run the program, it will stop at that point and then you'll be able to hover your mouse over the variables and see what values they have. Alternatively add in SET STEP ON to the code.
>>
>>
>>Ok, figured it out. It's showing "m.bnin=0064627,0079246" which is exactly what I put in. Even down at the "getwordcount" portion it's still showing both, but it never cycles back through and gets the second number, it only processes the first and hits the ENDFOR. Once it gets to the "OpenTable" line it's only passing in the first number I entered and never gets to that point again to add the other numbers.
>
>I can't see why GetWordCount() is returning 1. Can you run this exact code in your command window and tell me what ou get?
>
>messagebox(GETWORDCOUNT("0064627,0079246"))


That exact code returns a 1.

If I do this (like you did earlier):

?GETWORDcount("0079246,0064627",",")

I get a 2.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform