Forum Discussion
This should help:
- kimmatsumoto7 years agoContributor
Hi...thanks to everyone for their help. It was suggested that I include what I'm trying to achieve...
I'm writing the contents of a grid to a text file (notepad) which will be used as a baseline during a file compare. The problem is the file includes a datetime stamp which will cause the file comparison to always fail.
The notepad file looks like this: "SYSDBA","05/17/2017 1:09:40 PM","Update","","BRANCH","1","0"
My goal is to end up with a file looking like one of the following:
"Update","","BRANCH","1","0"
"SYSDBA","Update","","BRANCH","1","0"
This is a copy of the code I'm using:
procedure Test;
var
tempFileName4, FileName4, str : OleVariant;
begin
tempFileName4 := Project.Path + '4199_4_temp.txt';//Save 2nd row in listview to file
listview := TBO.HistoryForm.CDSListView1;
ListViewItemToCSVFile4(listview, tempFileName4, 1);
//Verify 2nd item displays: BRANCH (field), 1 (Old Value), 0 (New Value)
if Files.Compare(FileName4, tempFileName4) then
log.Checkpoint(tempFileName4+' matches baseline.');end;
Thanks in advanced,
Kim
- shankar_r7 years agoCommunity Hero
Hi,
ListViewItemtoCSVFile4 is writing output value to a tempFilename4
Then you are comparing tempFileName4 with FileName4.
If my understanding is correct,
FileName4 will have the contents with Timestamp and tempFileName4 will not have the timestamp
So, Checkpoint going fail in this scenario.
Correct me if my understanding is wrong
- tristaanogre7 years agoEsteemed Contributor
If ListViewItem4 is under your control, your answer is there. When you're reading the listView and writing it to the file, detect when a field contains a date (use aqString.StrMatches and use a regular expression). If the field contains a date, write out a blank, otherwise, write out the actual value.
Related Content
Recent Discussions
- 17 hours agotramuntana
- 3 days agoSlickRick