Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

read variable into realodscript from text file

Hello,

Someone know how can I read into the reload script value from text file.

for example, I have a text file which is including the number 91.

I want to run the reload script so it will take the number 91 from the text file (saving it as variable) and then will execute

for i=1 to 91

How can I do it?

Thanks,

Nimrod

1 Solution

Accepted Solutions
Not applicable
Author

Hi Nimrod,

You can read this from the txt file.

LOAD DField

FROM Data.txt;

LET vDField = FieldValue('DField', 1);

FOR I = 1 TO $(vDField) STEP 1

-Yoursourcode

NEXT

Hope, it will give you idea to read data from any external sources.

Regards,

Raj Kishor

View solution in original post

8 Replies
Not applicable
Author

I think in case of variable declaration u have to make it from qv script or from variable overview tab only.......

Regards,

Dushyant

Not applicable
Author

it's exactly what I want... the question is how to do it.

Not applicable
Author

Hi Nimrod,

You can read this from the txt file.

LOAD DField

FROM Data.txt;

LET vDField = FieldValue('DField', 1);

FOR I = 1 TO $(vDField) STEP 1

-Yoursourcode

NEXT

Hope, it will give you idea to read data from any external sources.

Regards,

Raj Kishor

Not applicable
Author

Thx for your response.

how do I have to save this field into the txt file?

Not applicable
Author

I will appreciate your response. thx.

Miguel_Angel_Baeyens

Hello,

If you mean how to save the value you are going to read following Raj's code posted above, you can do that in a QVD file or TXT file, just make sure it has the field name you are going to use in the script, in this case "DField", creating a textfile with the following

DField91


Hope that helps.

Not applicable
Author

Hi,

If I am well understanding you question then you need to read the variable from txt file. So in this case you need to create a txt file and define you varialbes there same as QlikView syntax. Then you can include that text file in you script from Edit->Include File. For exanple let's write a variable in txt file called vLoopLimit which should be written as under:-

Let vLoolLimit = 91;

So when you include this txt file into ur script you can easily access this variable.

bingli881
Contributor
Contributor

How do I use this variable?