Skip to Content
author's profile photo Former Member
Former Member

PB 12.6 classic failures when exporting to XLSX

I have an application that has been upgraded from PB8 to PB11.5 and most recently to PB 12.6 Classic Build 3506.

A lot of this application is outputting data to Excel for the user. It has all worked great except for when we went to saving as XLSX. The application runs and saves a file and thinks it succeeds. You cannot open the file because it is corrupted.

We have a DW on page. The DataObject is a DW that is basically a template. The problem was with the template DataWindow that got assigned. I did an 'edit source' on it to see the code.

Question #1. It says release 8; at the top, which I assume was the original version that it was developed under. I can change it to 12.6, but is there something that should automatically change it?

Inside the file, the table was being built,

table(column=(type=char(60) updatewhereclause=yes name=title dbname="TITLE" )

column=(type=char(8) updatewhereclause=no name=osd_code dbname="OSD Code" )

.....

..... all the way to completion

The 'data' string looked like this(similar):

data("DIRECT" null null null null null null, null null "", null "OSD Code".......

All the blanks cells in the template were represented throughout the data string 3 different ways.

#1 null

#2 null,

#3 "",

Question #2. I did not develop this, so I am unsure what happened here. Why is a blank represented 3 different ways?

I got this to work when I modified the 'data' string to all use "",. Using all 'null' or all 'null,' did not work.

So, I moved on to the next place that outputs an XLSX file that was failing with the same error.

When I would 'edit' the DW, it had both string and number's defined.

I got this one to work by going thru the 'data' string and figuring out where it was going to be representing strings. I replaced those 'null' with "", and it worked correctly.

I can output these files using EXCEL8! fine without any modification, but the XLSX bombs b/c of the XML. I have other issues I would like to discuss, but this is a good start.

All suggestions are apprecitated.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 14, 2016 at 08:29 PM

    Chris,

    Have you deployed PBDWExcel12Interop126.dll and Sybase.PowerBuilder.DataWindow.Excel12.dll? This was a new required file in later releases.

    Chris Craft

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 14, 2016 at 02:51 AM

    Hi Chris;

    Just edit the DW source and change the 8 to a 12.6 - then save the DW source. That will complete the DWO migration to version 12.6. The migration assistant in PB never migrates any DWO source properly (IMHO). I always check all my DWO's source "release" setting & edit the release number accordingly as part of my standard migration procedure.

    Regards ... Chris

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I would call it a bug when I can detect an error and fix it by just updating the DWO source code to current levels via my little release # change. I must have proved that to the Sybase Engineer's in over a dozen beta's. 😉

  • Posted on Jul 14, 2016 at 06:42 AM

    Hi Chris,

    about your question #2.

    I've tried in 12.1 classic:

    If you only insert a row in the data view in datawindow painter without editing, all values are null (without comma).

    If you edit a value for a column and the save the datawindow, the value for that column is not null. I don't know a way to return it to null in the datawindow painter. If you clean the field the data entry will be "", (with comma).

    I don't know how entries may become null,

    Maybe older versions had saved a litte be different.

    However, do you think this is the reason for export problems?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      When a column is defined to be a string, if the code behind was using null for that column, the XLSX file that was output would not open. It was corrupted. I would edit the 'data' string in the source to make sure that each column that was string would be ' "", ', then it would open and display correctly. If the column is defined as a number, the null would work correctly.

  • author's profile photo Former Member
    Former Member
    Posted on Jul 14, 2016 at 06:37 PM

    This brings me to my next problem that I have not been able to overcome. We are reading in a template into a DW. It is basically a row at the top, all strings and about 10 or so of them. Not really relevant I don't think?

    Anyway, the code sets the template and then it begins to insert rows using SetItem. Before inserting, it does a dw.SetItem(0) to make space for the row. The issue here is that this portion is in a loop. If it only loops thru one time, it will output correctly to XLSX. But if it has to output more than one time, the XLSX file is created but will not open b/c it is corrupted. Each iteration thru the code is setting the same number of rows.

    I can run the code thru the debugger and after the first iteration, I make it jump the rest and output the XLSX. It works great. I run again and after the first iteration, I let it try and set one single column with a text value, then skip the rest and output the data to XLSX. It outputs, but it will not open as it is corrupt.

    Before each row is added using SetItem, a new row is inserted so I do not know why that is causing it to fail. If I output using EXCEL8, it works great. Here is a code snippet of where the data is being put into the DW. I cannot find a reason why the restriction is there to only allow one iteration. I have looked over the DW definition, but I do not see anything.


    PBprob.png (27.5 kB)
    PBprob.png (27.5 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 15, 2016 at 03:18 PM

    I had also issues with saving large files (blobs) after migrating to PB12.6 and open a case at SAP support.

    And I got help from a nice support guy!!!

    In my case it was a new System option - "Use 1-byte structure member alignment in external function" - that I had not checked.

    My be this helps you, too.

    Good luck!

    Ludwin


    use 1-byte.png (38.2 kB)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.