Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

TimeStamp on Records in a file updated from QlikView

I ha.ve reasons to write out a csv file from a doccument.  The csv is created / added to via pushing a button on the doccument with the file beins read back in at the next reload to update files used in the next doccument.  I need to include a timestamp on each record / row written out so that when processing the file back in I can select only the most current records as the records have been selected and updated by the users.  When I use a filed like:

Timestamp(Now(1)) as Test_Time_Stamp,

all that I get in the file is the last reload time, now the time that the button was pressed.

Any ideas or suggestions would help!

Thanks!

9 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

1. Create a variable vExportTime.

2. Add an expression to your export table =vExportTime.

3. Make the first Action of your button to set variable vExportTime to =now(1)

-Rob

http://robwunderlich.com

http://qlikviewcomponents.org

Not applicable
Author

It doesn't appear to work, I may have gotten it wrong. I did in the button properties:

Set Variable vDummy1 =Now(1)

Export

What I get in the file is the last time that the load script was run.  I export the data several times at least 1 minute apart but the time is always the same.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I was assuming you were using a macro based export, not an Action export. To use an action based export (with QV11), I have a theory that you could use the Dynamic Update action to set an "ExportTime" field to now(1). However, I can't seem to make this work and don't yet understand why.

If yo can use a macro, an alternative is to make a straight table using the technique as suggested above and use a macro export.

ActiveDocument.GetSheetObject("CHnn").Export("myfile.csv")

The action approach is preferable. If I get a working example I'll let you know.

-Rob

Not applicable
Author

I think that I still have it wrong.  Created the straight table with all of the elements including the calculated time stamp. Pun in the macro and when I press the button I get a display of the Macro.  The Macro is:

sub ExportMyFile

ActiveDocument.GetSheetObject(CH37).Export("myfile.csv")

end sub

Not applicable
Author

I think that I still have it wrong.  Created the straight table with all of the elements including the calculated time stamp. Pun in the macro and when I press the button I get a display of the Macro.  The Macro is:

sub ExportMyFile

ActiveDocument.GetSheetObject(CH37).Export("myfile.csv")

end sub

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think you need double quotes around CH37.

Not applicable
Author

When I put in the double quotes the module displays again with the parens in red and the curser adter ("CH37" and befor the )

ActiveDocument.GetSheetObject("CH37").Export("myfile.csv")

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You need a second required argument to Export, the seperator char.

ActiveDocument.GetSheetObject("CH37").Export "myfile.csv", ","

-Rob

Not applicable
Author

I'm now getting a message 'Cannot open file myfile.csv for writing!'.  I think that this is colser than I have been previously.