Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
ajaykumar1
Creator III
Creator III

Read the string from text

Hi All,

I hope all are doing good.

I have a requirement to read the start and end time of batch jobs and store in qvd. For this I need to get the task name from text and call into table, and store into qvd.  Example: In below script text is $(Include=D:\script\create_order.qvs). I need to get the "create_order" as the task name and call into "Sales" table then store into qvd.

LET vStartTime = Now();

$(Include=D:\script\create_order.qvs)

LET vEndTime = Now();

Sales:

LOAD

'create_order' AS ReloadTable,

'$(vStartTime)' AS StartTime,

'$(vEndTime)' AS EndTime

AutoGenerate (1);

LET vStartTime = Now();

$(Include=D:\script\derive_order.qvs)

LET vEndTime = Now();

Sales:

LOAD

'derive_order' AS ReloadTable,

'$(vStartTime)' AS StartTime,

'$(vEndTime)' AS EndTime

AutoGenerate (1);

Hope you understand requirement. let me know if you need any information.

Thanks

Ajay

7 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

What is your question? You appear to have done everything except:

You need a Concatenate LOAD statement to get the log file history from the qvd

and a 'STORE Sales' statement  to save the updated log file.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Kushal_Chawda

what is the problem statement?

ajaykumar1
Creator III
Creator III
Author

Hi Jonathan,

I don't want to write "create_order" or "derive_order" in Sales table, it should automatically read from the texts $(Include=D:\script\create_order.qvs),.....

then i will concatenate these tables ans store into qvd.

sorrakis01
Specialist
Specialist

HI,

You can create a Bucle... to read all qvds.

And the the file will be the name.

For each File in filelist ('c:\directory\'

LOAD $(File) as Name .......

next File

Regards

sasiparupudi1
Master III
Master III

set vFilePath='D:\script\create_order.qvs';

let vFileName=subfield(TextBetween('$(vFile)','\','.'),'\',-1);

LET vStartTime = Now();

$(Include='$(vFilePath)');

LET vEndTime = Now();

Sales:

LOAD

'$(vFileName)' AS ReloadTable,

'$(vStartTime)' AS StartTime,

'$(vEndTime)' AS EndTime

AutoGenerate (1);

HTH

Sasi

sasiparupudi1
Master III
Master III

set i=0;

set vConcatenate='';

sub GetFileNames(DirName,extension)

    for each FoundFile in filelist(DirName & extension)

     if i>0 then

        let vConcatenate='Concatenate';

     End if  

     let i=i+1;

            let vFileName=subfield(TextBetween('$(FoundFile)','\','.'),'\',-1);

            LET vStartTime = Now();

               $(Include='$(vFilePath)');

            LET vEndTime = Now();

          Sales:

            Load

            '$(vFileName)' AS ReloadTable,

            '$(vStartTime)' AS StartTime,

            '$(vEndTime)' AS EndTime

            AutoGenerate (1);

    next FoundFile

end sub

Call GetFileNames('D:\script\','*.qvs');

sasiparupudi1
Master III
Master III

Hi

Did you manage to solve your problem?

Sasi