Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Read all LOG files from a Directory and Extract the FROM clauses

Hello!

I need to load and read all LOG files from a directory and then extract those lines that have a FROM clause.

Do you know how could I do this?

Thank you!

6 Replies
mjayachandran
Creator II
Creator II

You can use "File Wizard" to achieve the same.

1. 'Edit Script' ----> 'Table Files'

2. Select the log file you want to query

3. Choose how you want to delimit your data. ' Click Next'

4. Click 'Enable Transformation Step'

5. 'Conditional Delete' under 'Garbage Tab'

You can play around from here.

ashfaq_haseeb
Champion III
Champion III

Hi,

Try like this

LOAD *

FROM

*.txt

(txt, codepage is 1252, no labels, delimiter is '\t', msq)

where Field>0;

Regards

ASHFAQ

Andrea_Ghirardello

I don't know exactly the result you would obtain, but you can

  • load only the rows you are interested to through the script capabilities

MyTab:

add LOAD *

FROM

*.txt

(txt, codepage is 1252, delimiter is '\t', msq)

where Field like '*From*';

  • use regular expressions once all data have been loaded, see

How to use regular expressions

Hope this helps

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Assuming you want to parse QV document logs, there may be no single method to do this. AFAIK a FROM keyword may be present on a line by itself (standard QV formatting) or it may be followed by a filename and options.

Are you trying to lift the data sources from a document log?.

Not applicable
Author

Yes, I need to extract all the inputs that are used in a QVW...

Do you know a practical way to do it?

Thanks.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

No, not really. And that's for a very simple reason: QlikView script uses a language with a non-context free grammar, meaning that in order to obtain the meaning of a particular "FROM" you'll have to know the context of this particular FROM. For example, this is a valid script statement:

SET FROM = LOAD;

SET "Other FROM" = LOAD;

FROM :

$(FROM) $(Other FROM), FROM

FROM

FROM

(txt)

;

Which FROM do you want to select?.

On the other hand, if you can be sure that a particular statement format is used for all LOAD statements, then there are possibilities. For example, if the name "FROM" is never used for anything else that the FROM clause, and FROM and source path always appear on the same line, then the log parsing becomes fairly straightforward, even in a QV script.

Peter