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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
micheledenardi
Specialist II
Specialist II

How to add and replace text in .txt file

i have a txt file where i write last report reload time and i'm using this code:

Conf:

Load capitalize(DocumentPath()) & ': Reload Completed: '& now() as Confirmation

AutoGenerate 1;

STORE Conf Into \\...\Conf.txt (txt);

Drop Table Conf;

i want to use this file to write the reload time of many report so my request is:

How can i ADD a text in a txt file without delete the content already present?

i want only the last reload time for every report in my .txt file and not the chronology so when i reload data of a report that have already write a line in .txt file the report must replace the his older line with the new one. It's possible or i have to create a file for each report ?


thank's

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

You can read the old file first and then add the new information by the auto concatenate.

Conf:

LOAD * FROM [\\...\Conf.txt (txt)];

Load capitalize(DocumentPath()) & ': Reload Completed: '& now() as Confirmation

AutoGenerate 1;

STORE Conf Into \\...\Conf.txt (txt);

Drop Table Conf;

View solution in original post

7 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Instead of storing this in a text file and then reading from this , you can directly use ReloadTime() in the script, you will get the last reload time of the Dashboard

LET vLastReloadTime = ReloadTime();

you script here

'

'

'

Hope this helps you.

Regards,

Jagan.

micheledenardi
Specialist II
Specialist II
Author

I need to have reloadtime date of my reports in a txt file to use it on external app.

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
jagan
Partner - Champion III
Partner - Champion III

Then save it like below in separate txt file

LastReloadTime:

LOAD

Now() AS ReloadTime

Autogenerate 1;

STORE LastReloadTime INTO FileName.txt;

Hope this helps you.

Regards,

Jagan.

micheledenardi
Specialist II
Specialist II
Author

your solution doesn't resolve any my problem

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
jagan
Partner - Champion III
Partner - Champion III

It is not possible to update the file in Qlikview script.

Regards,

Jagan.

petter
Partner - Champion III
Partner - Champion III

You can read the old file first and then add the new information by the auto concatenate.

Conf:

LOAD * FROM [\\...\Conf.txt (txt)];

Load capitalize(DocumentPath()) & ': Reload Completed: '& now() as Confirmation

AutoGenerate 1;

STORE Conf Into \\...\Conf.txt (txt);

Drop Table Conf;

khag_hs
Contributor II
Contributor II

It is possible to update a txt-file in Qlickview script.

Try this:

1. build a txt-File named "Reload"

2. execute this script:

//*********************************************

//update file

//*********************************************   

v_reloadtime=ReloadTime();
set v_app="test update"; //name of your qvw-file
Reloadtime:
LOAD * INLINE [
    App, Reloadtime
    $(v_app), $(v_reloadtime)
]
;
store Reloadtime into Reloadtime_t.txt (txt);
EXECUTE cmd.exe /c copy Reloadtime.txt +Reloadtime_t.txt Reloadtime.txt;

//*******************************************************

You have to allow Qlickview to execute external programs first!