8 Replies Latest reply on Nov 15, 2017 2:03 PM by FrancisNyarko

    PiConfig Error Whiles Selecting Records

    FrancisNyarko

      Dear All,

       

      I am trying to extract data from Pi using PiConfig with the script below:

       

      @echo data

      @table piarc

      @mode list

      @stype delimited

      @istr tag,starttime,endtime,count

      @ostr time, value

      @ostr ...

      @output C:\test\data.csv

      sinusoid,*-1d,*,9999

       

      I get the error "*PIconfig Err> Error reading record from table... Rec: <sinusoid>". And when I checked the generated output in C:\test\data.csv, below is the data in the file.

       

      *> sinusoid,  *-1d,   *,   9999

       

      It is adding *> in front of the tag name although this is not in my PiConfig Query. What could be causing this please.

       

      Regards,

       

      Francis.

        • Re: PiConfig Error Whiles Selecting Records
          rschmitz

          Hi Francis,

          I see in the above sample script you've included the line "@echo data", this will echo the requested data you've queried from piconfig. If you remove this echo line then "*> sinusoid, *-1d, *, 9999" will be removed from the resulting output file.

          --Rob

            • Re: PiConfig Error Whiles Selecting Records
              FrancisNyarko

              Dear Robert,

               

              Thanks for the prompt feedback. I have modified the script to:

               

              @table piarc

              @mode list

              @stype delimited

              @istr tag,starttime,endtime,count

              @ostr time, value

              @ostr ...

              @output C:\test\Results.csv

              sinusoid,*-1d,*,99999999

               

              However when I run this, I still see the same error and output.

                • Re: PiConfig Error Whiles Selecting Records
                  rschmitz

                  I tested on my own system and needed to explicitly add "echo off" rather than just removing that line in order to get the desired behavior, my apologies. Try the script with "echo off" and see if this produces the behavior you're looking for.

                  --Rob

                    • Re: PiConfig Error Whiles Selecting Records
                      FrancisNyarko

                      Dear Robert,

                      That worked.

                      However I get the error below:

                       

                      *PIconfig Err> Error reading record from table... Rec: <sinusoid>

                      *[-15003] Generic Requested Item Not Found

                       

                      When I run the SQL below in PI SQL Commander Lite I get data but when I use the PiConfig script I get the error above.

                      SELECT *

                       

                      FROM [piarchive]..[picomp2]

                       

                      WHERE tag = 'sinusoid'

                       

                          AND time BETWEEN '*-1h' AND '*'

                       

                       

                      echo off
                      @table piarc
                      @mode list
                      @stype delimited
                      @istr tag,starttime,endtime,count
                      @ostr ...
                      @ostr value, status, time
                      @output C:\test\Results.csv
                      sinusoid,*-1h,*,999999999

                       

                       

                        • Re: PiConfig Error Whiles Selecting Records
                          rschmitz

                          That error typically appears only when there is no tag named "sinusoid." Can you please confirm there is a tag named sinusoid on this server? Is it possible you're querying a different data archive in PI SQL Commander Lite than in piconfig?

                          --Rob

                            • Re: PiConfig Error Whiles Selecting Records
                              FrancisNyarko

                              Dear Robert,

                              Running the SQL script below give me results.

                              SELECT * FROM [piarchive]..[picomp2] WHERE tag = 'sinusoid' AND time BETWEEN '*-1h' AND '*'

                              I run the PiConfig script as C:\Program Files (x86)\PIPC\adm>piconfig < c:\test\Script.txt

                              I am assuming this is also pointing to the same server as we have one installation.

                              Is there a way to know what data ipconfig is pointing to please.

                              Francis.

                                • Re: PiConfig Error Whiles Selecting Records
                                  rschmitz

                                  Francis,

                                  At this point I think it might be worth calling into our Tech Support line to have a remote session and find out the root cause of this, but it sounds like there's an issue finding the "sinusoid" pi tag which could be due to permissions issue, what server each program is pointing to, or other some other reason.

                                  As far as checking what server piconfig is pointing to, it should automatically point to the default PI Server listed in the PISDK Utility

                                  --Rob

                                    • Re: PiConfig Error Whiles Selecting Records
                                      FrancisNyarko

                                      The script below works. Thanks for the support.

                                       

                                      piconfig -node PiServerName -port 5450 -username UserNameHere -password PasswordHere < c:\test\PiExtract.txt

                                       

                                      Contents of c:\test\PiExtract.txt

                                      echo off

                                      @table piarc

                                      @mode list

                                      @stype delimited

                                      @istr tag,starttime,endtime,count

                                      @ostr ...

                                      @ostr tag,time,value,

                                      @output C:\test\Results.csv

                                      tagename,*-1h,*,99999999999999

                                      tagename,*-1h,*,99999999999999

                                      .

                                      .

                                      .

                                      tagename,*-1h,*,99999999999999

                                      @exit