16 Replies Latest reply: May 10, 2010 10:06 AM by At titude RSS

    Reading the path from ini

      Hi all,

      I have following things in ini. Let me know how can I read the Path which is there in ini and insert in to qlikview loadscript. This is very urgent requirement. Hope some one can help me out soon.

       

      [DBENG]
      Start=1
      Memory=300
      TCPIP=1

      HIDE=0
      Path=D:\PA42009\10012009

      [UpDn]
      secondStock Rar=120
      second=120


       

        • Reading the path from ini
          juergm

           

           


          LOAD mid(@1,6) as mypath
          FROM
          [D:\BI\QlikView\Examples\ini-file.ini]
          (txt, codepage is 1252, no labels, delimiter is '\t', msq)
          WHERE left(@1,5) = 'Path=';


          P.S. you need a slash to close the code section /code in square brackets []



            • Reading the path from ini

              Hi J M J G S,

              Thanks for your help. I need to check whether it works or not. But in the mean time can you please explain how it works. As the source which I have posted is just the sample. So I need to check how it works in the original ini.

              Thanks in advance,

               

              • Reading the path from ini
                <blockquote><pre>
                mid(@1,6) // What is the use of @ here. It is not given in the tutorial

                left(@1,5) = 'Path='; //What is the use of @ here. Also let me know what will be assigned in the 'Path='



                  • Reading the path from ini
                    juergm

                    @1 contains the complete text line read from the file.

                    If you use the table files load wizard and point to an .ini file to read you will see this in the generated code.

                      • Reading the path from ini

                        Hi J M J G S,

                        I am looking forward for your reply. Please help me out

                         

                          • Reading the path from ini
                            juergm

                            You need to post me your .ini file too to see what's going wrong

                            Edit: It works on my machine with the text you had posted above copied to a file

                              • Reading the path from ini

                                 


                                Juerg Maier JmiD GmbH Schweiz wrote:
                                You need to post me your .ini file too to see what's going wrong
                                Edit: It works on my machine with the text you had posted above copied to a file<div></div>


                                I have posted the ini file. Please check!

                                 

                                  • Reading the path from ini
                                    juergm

                                    Hi Rikab

                                    Misunderstanding, you sent me your load script which looks correct to me. To see what is going wrong I will need to get your actual ini file from which you want to extract the path.

                                    Juerg

                                     

                                      • Reading the path from ini

                                         


                                        Juerg Maier JmiD GmbH Schweiz wrote:
                                        Misunderstanding, you sent me your load script which looks correct to me. To see what is going wrong I will need to get your actual ini file from which you want to extract the path. <div></div>


                                        Yes! It was a misunderstanding. I am able to get the path now.

                                        Can you do me a help. Can you please explain how it works. So that I can do the required changes myself to read the information from other ini.

                                         

                                         

                                          • Reading the path from ini
                                            juergm

                                            Rikab

                                            the load will read line for line through your ini file. You access the information of the read in line through the @1 reference.

                                            You are interested in lines starting with "Path=", that is why the script has a where condition.

                                            The left(p1,p2) function will return the p2 number of characters from the p1 string, this is compared to the fixed string 'Path='.

                                            As you are interested in the path itself the mid(p1,p2) function will give you the part of the string starting at character position p2.

                                            You can read about the functions in the QlikView help file or in the documentation. The documentation file is located in the installation directory, in a standard installation it will be in the folder

                                            c:\Program Files\QlikView\Documentation

                                            If you can not follow these descriptions you might need to get some professional help building the app or join a class to get you up and running.

                                            Juerg

                                              • Reading the path from ini

                                                 


                                                Juerg Maier JmiD GmbH Schweiz wrote:
                                                You access the information of the read in line through the @1 reference. <div></div>


                                                Yes! Now managed to get something how that script works now. But only thing which I am not able to understand is the above line. I also referred the tutorial but there is not even one example of mid function with @.

                                                Can you please explain little more? So for the trouble.

                                                 

                                                 

                                                 

                                                  • Reading the path from ini
                                                    juergm

                                                    Rikab

                                                    In Book 1, page 309 you find the explanation of the load statement.

                                                    You refer to fields by either using a fieldname, the @<fieldnumber> syntax or by specifically extracting characters from specified positions (@<start>:<end>.

                                                    As not all of our lines look the same we simply load every line into <Field_1>, which is accessed in the script specifying @1. So @1 contains a whole line of your ini file and this is repeated for every line in the file.

                                                    I am running out of words - I can't teach you how to program - start to read books or educate yourself otherwise on the concepts of programming.

                                                    Juerg

                                                      • Reading the path from ini

                                                         


                                                        Juerg Maier JmiD GmbH Schweiz wrote:
                                                        In Book 1, page 309 you find the explanation of the load statement.
                                                        You refer to fields by either using a fieldname, the @<fieldnumber> syntax or by specifically extracting characters from specified positions (@<start>:<end>.
                                                        As not all of our lines look the same we simply load every line into <Field_1>, which is accessed in the script specifying @1. So @1 contains a whole line of your ini file and this is repeated for every line in the file.
                                                        I am running out of words - I can't teach you how to program - start to read books or educate yourself otherwise on the concepts of programming. <div></div>


                                                        Thanks for your help and suggestion I will take this into consideration :-(

                                                         

                                          • Reading the path from ini
                                            Rakesh Mehta

                                            Try this:

                                             


                                            LOAD
                                            subfield(@1, '=', 1) as Variable,
                                            subfield(@1, '=', 2) as Value
                                            FROM D:\BI\QlikView\Examples\ini-file.ini (txt, codepage is 1252, no labels, delimiter is '\t', msq)
                                            WHERE wildmatch(@1, '*=*') > 0;


                                      • Reading the path from ini

                                         


                                        Juerg Maier JmiD GmbH Schweiz wrote:<blockquote><pre>LOAD mid(@1,6) as mypath
                                        FROM
                                        [D:\BI\QlikView\Examples\ini-file.ini]
                                        (txt, codepage is 1252, no labels, delimiter is '\t', msq)
                                        WHERE left(@1,5) = 'Path=';

                                        P.S. you need a slash to close the code section /code in square brackets []

                                         

                                        Same thing I have tried in my sample application which is attached to it but it is not showing any values. Please check!

                                         

                                      • Reading the path from ini
                                        Rob Wunderlich

                                        Here's an example of reading the value, inserting in a variable and using the variabe in a subsequent LOAD.

                                        LOAD @2 as Path
                                        FROM readinii.ini
                                        (txt, codepage is 1252, no labels, delimiter is '=', msq)
                                        WHERE @1 = 'Path'
                                        ;
                                        LET vPath = peek('Path');

                                        LOAD *
                                        FROM $(vPath)\myfile.txt
                                        ;

                                        -Rob