Plex 2E

  • 1.  [PLEX 7.0 WinNTC] Exec SQL return fields in different order on odd or even ocurrences

    Posted Jul 01, 2014 02:09 PM

    Good afternoon,

     

    We are using the following function with one Exec SQL statement to run a SELECT query on a remote database, form an application where we integrate invoices from our application. The remote server is added as a Linked Server on the server with the PLEX application database.

    When we start the application, this works properly on odd ocurrences and mix the values returned on the fields on even occurences.

     

    We edited the cpp generated, to print the result of the wrapper generated by PLEX with this instruction and it prints different values for the same columns. The record is the right one, but the order of the columns is not.

    1st time:

    [][LCB][2014][305][][][][][][0][-1236000][-1236000][44][44]

     

    2nd time:

    [][2014][LCB][305][][][][][][-1236000][-1236000][0][44][44]

     

    3rd time:

    [][LCB][2014][305][][][][][][0][-1236000][-1236000][44][44]

     

    4th time:

    [][2014][LCB][305][][][][][][-1236000][-1236000][0][44][44]

     

    The number of columns returned from the SELECT are the same in number and order of the variable to where the result is sent (FetchPayingDocuments).

    The same procedure, same SELECT values for the WHERE clause, all equal, different column order on odd and even occurrences.

     

    This code worked before, the server where the PLEX application runs was reinstalled, has the same PTF as before.

     

    Any idea or help would be appreciated.

     

    Thank you.

     

    Best regards.



  • 2.  Re: [PLEX 7.0 WinNTC] Exec SQL return fields in different order on odd or even ocurrences

    Posted Jul 02, 2014 01:40 PM

    I do not know if this could help you, I had once this problema and it was I had inside the same function 2 diferents views from the same database, remember Fetch functions only work with one view.



  • 3.  Re: [PLEX 7.0 WinNTC] Exec SQL return fields in different order on odd or even ocurrences

    Posted Jul 03, 2014 04:54 AM

    Thank you very much for your response Hugo, unfortunately that is not the problem.

    The function only has one view. Despite using a variable and not executing the SQL to the View variable, they had different number of fields and order, so despite this working before, I changed the view to contain only the fields returned by the query and with the same order. Made no difference as well.

     

    Just another note, the fields order before was mixed even more than this, but I changed the type of the fields which were "wrong", like the date, which was string before and now really is date on the model as is on the database. This made the column order less messy, but now it still mess with fields that are of the same type. The first 2 are both strings and the last 3 are all floats.

     

    Any more ideas anyone?

    Thank you.

     

    Best regards.



  • 4.  Re: [PLEX 7.0 WinNTC] Exec SQL return fields in different order on odd or even ocurrences

    Posted Nov 27, 2014 10:18 AM

    Hi,

     

    So, I found what was causing this issue.

     

    As stated above, the EXEC SQL was done to a variable, not the "VIEW" variable, but another one with the same fields in the same order.

     

    Using the "FetchPayingDocuments" variable, the cpp was generated with the access to the wrapper columns on the form of theWrapper->GetColumn(i) as can be seen on my second image on the first post.

     

    Just for the sake of sanity, depite PLEX help indicating that we can do the EXEC SQL into a variable ("SQL statements are defined within a source code object. When using SELECT statements, the first row selected is returned into the specified output variable. If no output variable is specified, the view variable is used."), I decided to try and do it to the "View" variable.

     

    This is the cpp generated:

     

    As you can see, the code to access the columns on the wrapper is quite different and this does work withtout the previous issue of returning the columns on the correct order in odd fetches and not in even.

     

    Best regards.