Advertisement

05.15.2008 at 06:50AM PDT, ID: 23405073
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.5

CSV import going haywire

Asked by sreeser in Lotus Domino Email Server, Lotus Notes

Tags: , , ,

I have a script that has been running fine for a while importing a CSV file into a NotesDB.  When it gets to the value in the 3rd line of the file it throws off the rest of the import.  
I have included records before and after the problem one that import correctly.  I know notes is really picky about the delimiters, and I know the issue is related to the fact that unlike all the other rows formated like
$15.00
This row has a comma in the value and the then neccessary quotes around it.
"$1,936.00 "
There are 2 placeholders that the file needs after the the amount column, which I am not sure why, but when it hits the 3rd line the " end up in one placeholder, and the 2nd placeholder is not needed which throws off the rest of the import by one column.

I would rather not force the users to manually check for this issue and I cannot change how the file arrives as it comes from a vendor. (Can I just say how frustrating it is that vendors dont use Quote-comma as the standard!)

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
Dim session As New NotesSession
	Dim db As NotesDatabase
	Set db = session.CurrentDatabase
	'Set view = db.GetView("Process")
	'Dim dc As NotesDocumentCollection
	'Set dc = view.Getalldocumentsbykey("New")
	'Call dc.StampAll("Status", "Output")
	Dim uiws As New NotesUIWorkspace
	Dim fileCSV As Variant
	'Declare variables to hold data
	
	Dim counter As Integer
	Dim doc As NotesDocument
	counter =0
	'setup file number
	filenum% = Freefile()
	'Ask user for file location	
	fileCSV =  uiws.OpenFileDialog(False, "Choose the CSV file","*.txt" ,"c:\pub")
	'If the user chose a file then process
	If Not Isempty(fileCSV ) Then
		Open fileCSV(0) For Input As filenum%
		Do Until Eof(filenum%)
			'Read a line of data
			Input #filenum%, REF_NUM ,CUSTOMER_REF , CARD_TYPE , STATUS , AUTH_NO , REGISTER_DATE , REGISTER_TIME , EXPIRY_DATE ,  GATEWAY , MERCHANT_CODE , TAG  ,  AMOUNT , PLACEHOLDER, PLACEHOLDER2, CARD_NUM , TRANSACTION_NAME 
			
			
			
			'Check to see if there is still a header row
			If STATUS= "STATUS" Then 
				
			Else
				'Create Notes document and write values to it
				Set doc = db.CreateDocument
				
				
				With doc
					.form = "Person"
					
					.MERCHANT_CODE = MERCHANT_CODE
					.GATEWAY = GATEWAY
					OrderDate = Cdat(REGISTER_DATE+ " " +REGISTER_TIME)		
					
					Msgbox "You imported " & counter & " records."
					.OrderDate = OrderDate
					.TAG = TAG
					.AUTH_NO = 	AUTH_NO
					.STATUS = STATUS
					.TRANSACTION_NAME = TRANSACTION_NAME
					If Trim(TRANSACTION_NAME) = "Refund" Then
						.AMOUNTDUE = 0 - Cstr(Strright ( AMOUNT, "$"))
					Else						
						.AMOUNTDUE = Cstr(Strright ( AMOUNT, "$"))
					End If
					
					.CreditCardType = CARD_TYPE
					.CreditCard = CARD_NUM
					.ExpDate = EXPIRY_DATE
					.CreditCardComments = REF_NUM
					.Status = "New"
				End With
			'save document
				Call doc.save(False, False)
          'The next two lines of code call up the document again and force a refresh of all computed fields as well as any validations.  
          'Not quite how it is documented in help ...but it works.
				Call doc.computewithform(True,False)
				Call doc.save(True,False)
				counter = counter +1
			End If
		Loop
		Msgbox "You imported " & counter & " records."
Attachments:
 
Import csv file (change .txt to .csv on saving
 
 
Loading Advertisement...
 
[+][-]05.15.2008 at 07:23AM PDT, ID: 21573944

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 07:44AM PDT, ID: 21574186

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 08:08AM PDT, ID: 21574459

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 08:12AM PDT, ID: 21574521

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Lotus Domino Email Server, Lotus Notes
Tags: Lotus, Lotus Notes, R7, LotusScript
Sign Up Now!
Solution Provided By: Bill-Hanson
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.15.2008 at 08:18AM PDT, ID: 21574590

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 08:28AM PDT, ID: 21574714

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 08:34AM PDT, ID: 21574782

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 09:28AM PDT, ID: 21575440

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 10:58AM PDT, ID: 21576452

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 11:03AM PDT, ID: 21576493

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.20.2008 at 03:01PM PDT, ID: 21610755

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 02:38PM PDT, ID: 21636015

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 02:48PM PDT, ID: 21636067

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 02:50PM PDT, ID: 21636076

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 02:59PM PDT, ID: 21636110

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 03:25PM PDT, ID: 21636220

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 03:45PM PDT, ID: 21636406

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628