Answered by:
qif file mixes the date and month

Question
-
Hi
I am trying to download transaction for my President`s Choice Mastercard. It will not work in the proper date format. It switches the day and month and it will not download any transaction after the 12 of the month.
It worked before and I not sure what has changed.
Any assistance would be appreciated.
thanks
Thursday, July 12, 2012 3:48 AM
Answers
-
cal.
it worked. now i just need to change the name of the file from test to what I am using. how can i open it? or is there a way to have it ask me for the file name?
thanks for your patience.
- Marked as answer by Steadylee Friday, July 27, 2012 2:33 AM
Friday, July 27, 2012 2:25 AM -
I am not seeing the difference. I replace the file, but it is not giving me the last line. It goes through so fast that I cannot see what it says.
I think you are running this a litte differently than I am, and that is OK. What you want to do is to add a "pause" line to your doit.bat file.
You could call the modified file "doit2.bat"
It could be similar to this:
===========begin doit2.bat===============
rem This line is a comment
qif_dt2.py test1.qif
pause
rem The line above is not a comment
===========begin doit2.bat===============You can change the filenames to your wishes. I only included the two "rem" lines to match the original example. They don't do anything. Adjust the second line to match your filenames. The "pause" line is the big change: it will cause things to pause until you press a key, such as the space bar. Then things will continue as before.
- Marked as answer by Steadylee Saturday, July 28, 2012 3:28 AM
Saturday, July 28, 2012 3:22 AMModerator
All replies
-
Money interprets the date as mm/dd or dd/mm according to the local settings in Money. I think it is the short date format.
You could make your computer's settings match the QIF, or you could use a utility to modify the QIF file before bringing the QIF file in.
I presume you are in Canada.
Thursday, July 12, 2012 9:04 PMModerator -
Money interprets the date as mm/dd or dd/mm according to the local settings in Money. I think it is the short date format.
You could make your computer's settings match the QIF, or you could use a utility to modify the QIF file before bringing the QIF file in.
I presume you are in Canada.
am in canada and thanks for your response.
Tried to change the settings in both the control pannel and in the money. No luck. Every other company's qif downloads without any problems.
Friday, July 13, 2012 7:03 PM -
When you type "date /t" without the quotes into a command window, I expect that you get
"13/07/2012". I get "07/13/2012"Look at the problem QIF file with Notepad. Dates are on the lines that begin with "D". Compare to your date order when you execute the date command with that of the QIF file. I expect they differ.
Since you have other QIF files that work fine, you should probably retain your dd/mm order on your computer.
I don't find a converter to recommend to you right now. I tried the bank of New Zealand converter, but besides changing the date, it change the P (payee) fields to M (memo) fields; that would not be good for Money. You may be able to search one out.
I could write you a converter in Python, but that would require you to download and install ActiveState Python or equiv. It would use regex, and it would use a search string such as
"^D(\d+)/(\d+)([/\']\d+)$"That may or may not make any sense to you, but it might inspire you if you are a programmer and wanted to write a utility in your favorite language.
I am rusty on C, plus by using an interpreter language, it makes it easier to inspect vs getting a *.exe file.
- Edited by Cal LearnerModerator Friday, July 13, 2012 8:47 PM
Friday, July 13, 2012 8:46 PMModerator -
Cal;
You are correct. that is exactly the way that the dates are showing up. Any assistance you can provide would be very much appreciated.
Thanks in advance.
Saturday, July 14, 2012 1:33 AM -
I wrote a little program/script called qif_date.py. I posted it on a site and had a link to download the file. However, when I tried the link, I got a fake pop-up virus checker. This is probably from a bogus ad. It was a fake attempt to simulate a virus checker screen. As a result, I removed the link. Copy and paste the program into a file named qif_date.py . The file is source code that Python can read and execute directly. The file contents are below between the begin and end lines. Note each line after the line that contains __main__ starts with 4 spaces. Anything after a # on a line is a comment.
You need to install ActiveState Python version 2.6 or 2.7 http://www.activestate.com/activepython/downloads http://downloads.activestate.com/ActivePython/releases/2.7.2.5/ActivePython-2.7.2.5-win32-x86.msi will go right to the 32-bit installer. http://www.activestate.com/activepython/downloads has links for 64-bit. version 3.x may work fine, but I tested with 2.6.
You will download the QIF file into the folder that contains the qif_date.py file...
Lets suppose you downloaded the file as xyz.qif . You would cd to the directory/folder and enter "qif_date.py xyz.qif" or "qif_date xyz.qif" without the quotes. . The program would read the xyz.qif file, it would interchange the month and day fields, and it would write the result back to xyz.qif . Since it interchanges the date and month, if you run it twice, you are back where you were.
There is no sanity checking such as inspecting the file to be converted to insure that it is in mm/dd format initially before converting to dd/mm format. The program is not guaranteed to work correctly, but it has worked for me at least once. I expect it to work correctly for you.
Here is the program content. There are 21 lines, 5 of which are blank. 7 of the lines are only comments. The lines after the line which contain "__main__" must be indented exactly 4 spaces. In my paste test, the indent level got a little off.
=======begin qif_date.py==============
#interchange day and month values for QIF file.
# If run twice on the same file, things are back as they were.
#useage: qif_date xyz.qif
# will change a mm/dd QIF file to a dd/mm QIF file, or vice versa
# 2012-07-15 Cal Learner.
# You are free to copy or modify as you wish.import os, sys, re
if __name__=="__main__":
qiffile= open(sys.argv[1],'r') #open file named on command line for read
# Input file read in as parameter. Output file fixed in this case.
content=qiffile.read() #read whole file into string
qiffile.close()datestring=re.compile (r"^D(\d+)/(\d+)([/\']\d+)$", re.MULTILINE)
content2=datestring.sub(r"D\2/\1\3", content) #the big substitution
file2= open(sys.argv[1],'w') # open the same for write
file2.write(content2) #write the modified content
==========end qif_date.py===============
- Edited by Cal LearnerModerator Saturday, July 14, 2012 3:27 PM
Saturday, July 14, 2012 5:06 AMModerator -
You will download the QIF file into the folder that contains the qif_date.py file...
Sorry for my inexperience, but i have downloaded and install the python, but I cannot find the folder that contains the qif_date.py file.
Can you please point me in the right direction.
Sunday, July 15, 2012 9:55 PM -
I had thought you would copy and paste into notepad, and adjust the indentation before saving as "qif_date.py".
To make thing easier, I have now uploaded to another site. Choose slow download, and be patient. http://www.filefactory.com/file/2y50l5dqik1v/n/QIF_DATE_PY
I initially had uploaded to a different site I have used in the past. In testing, had I got a fake virus indication... a web popup that pretends to be a virus checker that found a virus and wants you to buy their product to fix things. I think that is just via an ad. Still, that should not happen; that can stress people (but not as badly as actually clicking where the ad tells you to click). So now I tried file factory. File Factory makes you navigate through efforts to sell upgraded service. The file is 829 bytes long, although it may show as 1k in some places.
Good luck.. if you have trouble getting the file, check with a computer-oriented friend who will be able to help you get the qif_date.py file.
Monday, July 16, 2012 7:23 PMModerator -
I will give it a try and get back to you.
Thanks for your patience. This is pretty cool. Not sure if I am going to call myself a programmer as of yet.
Monday, July 16, 2012 7:50 PM -
Cal;
I am not having very much luck with the solution.
I downloaded the file from File factory, then i download the qif file. I put them in the same folder, and run "qif_date.py july.qif""
this what i get
File "<stdin>", line 1
gif_date.py july.qif
is there any way you can do a screen capture of the steps. It woudl be very much appreciated.
thanks
Thursday, July 26, 2012 1:20 AM -
OK. New link for a new file: http://www.filefactory.com/file/37dn3q22su8l/n/QIF_DATE_ZIP
I see the old link no longer operates anyway.
The resulting QIF_DATE.ZIP file contains three files:
qif_date.py (829 bytes)
DOIT.BAT (88 bytes)
test1.qif (171 bytes)Unzip these three into your folder. Then type "doit" without the quotes. The doit.bat file will run. It has two comments (rem) lines plus one line that contains "qif_date.py test1.qif" without the quotes. That will run the file using the provided test1.qif. Each time, the month and day fields will interchange. Remember that doing it an even number of times puts the file back to where it was. The main thing is that I am providing a simple test file to try, plus the batch file makes the command typed a known thing. A screen capture, when things go right, is nothing to see. You see the command, and you see a new command prompt. That's it.
The qif_date.py file may differ slightly from what you had before, but functionally they should be the same.
I was not able to replicate your error. I could reference a non-existent file, but I did not get the same error.
- Edited by Cal LearnerModerator Thursday, July 26, 2012 2:02 AM
Thursday, July 26, 2012 2:01 AMModerator -
cal.
it worked. now i just need to change the name of the file from test to what I am using. how can i open it? or is there a way to have it ask me for the file name?
thanks for your patience.
Friday, July 27, 2012 2:25 AM -
cal.
it worked. now i just need to change the name of the file from test to what I am using. how can i open it? or is there a way to have it ask me for the file name?
thanks for your patience.
- Marked as answer by Steadylee Friday, July 27, 2012 2:33 AM
Friday, July 27, 2012 2:25 AM -
How about modifying the doit.bat file with Notepad? Replace the filename with whatever name you want.
Alternatively, just use the doit.bat file as an example and type the line yourself into a cmd window??
Friday, July 27, 2012 2:31 AMModerator -
I opened the doit file in notebook and it worked. thank you Cal.Friday, July 27, 2012 2:33 AM
-
I am glad it was successful. I have made a slightly-revised version I call qif_dt2.py. It's advanages are
1. It uses no indenting, so it is easier to copy the code and paste the code to a file named qif_dt1.py in a text editor such as Notepad. This eliminates the need to download. This is not pretty code. Not indenting in Python is very unusual.
2. It prints a results line that says, for example, "Swapped day and month for 2 dates in xyz.qif file."==========begin qif_dt1.py================
#qif_dt1.py; interchanges day and month values for QIF file.
#This version removes indents to make copy and paste of code easier
#also prints the number of date swaps made
# If run twice on the same file, things ar3 back as they were.
#useage: qif_dt2 xyz.qif
# will change a mm/dd QIF file to a dd/mm QIF file, or vice versa
# 2012-07-29 Cal Learner.
# You are free to copy or modify as you wish.import os, sys, re
qiffile= open(sys.argv[1],'r') #open file named on command line for read
# Input file read in as parameter. Output file fixed in this case.
content=qiffile.read() #read whole file into string
qiffile.close()datestring=re.compile (r"^D(\d+)/(\d+)([/\']\d+)$", re.MULTILINE)
content2,count=datestring.subn(r"D\2/\1\3", content) #the big substitution
print "Swapped day and month for ",count, "dates in ",sys.argv[1],"file."
file2= open(sys.argv[1],'w') # open the same for write
file2.write(content2) #write the modified content
============end qif_dt1.py====================Copy and paste the 22 lines between the begin and end lines into a file in a text editor such as Notepad. Name the resulting file "qif_dt2.py".
Of the 22 lines, 9 are only comments (lines starting with '#'), and 4 lines are blank.
This was tested with ActiveState Python version 2.6.5, but it should work fine with later versions.
Friday, July 27, 2012 6:37 PMModerator -
I am not seeing the difference. I replace the file, but it is not giving me the last line. It goes through so fast that I cannot see what it says.
Saturday, July 28, 2012 2:56 AM -
I am not seeing the difference. I replace the file, but it is not giving me the last line. It goes through so fast that I cannot see what it says.
I think you are running this a litte differently than I am, and that is OK. What you want to do is to add a "pause" line to your doit.bat file.
You could call the modified file "doit2.bat"
It could be similar to this:
===========begin doit2.bat===============
rem This line is a comment
qif_dt2.py test1.qif
pause
rem The line above is not a comment
===========begin doit2.bat===============You can change the filenames to your wishes. I only included the two "rem" lines to match the original example. They don't do anything. Adjust the second line to match your filenames. The "pause" line is the big change: it will cause things to pause until you press a key, such as the space bar. Then things will continue as before.
- Marked as answer by Steadylee Saturday, July 28, 2012 3:28 AM
Saturday, July 28, 2012 3:22 AMModerator -
Done and Done Cal.
You have been a major held for me. This thing has been bothering me for months.
Thanks
Saturday, July 28, 2012 3:28 AM