Skip to Content

Adding complex computed column at run-time fails in PB 12.6

I support a large 'vintage' application that was originally written in the late 90's, and has been migrated from version to version over the years. Currently I'm working to get it working in PB 12.6 Classic, build 3506, migrating it from PB 11.5

The first issue I've come across is that PFC treeviews are not working properly. After some debugging, I determined that the cause of the failure is the PFC code's creation of 'key' column in the datawindows being used to populate each level.

In the pfc_u_tv.of_createkey function, it looks at the linkages between the levels of a treeviews data, and then crafts an expression, and then uses that to create a computed column, which is subsequently used to uniquely identify the data.

The expression is a series of string concatenations, such as this:

expression='String(ctg_cd) + "#$%" + String(app_cd) + "#$%" + String(app_cd) + "#$%" + String(win_id) + "#$%" + String(ctg_cd) + "#$%"'

This expression is then used in a modify statement to create the new compute key column:

ls_rc = ads_obj.Modify("create compute(band=detail x='0' y='0' " + &

"height='0' width='0' name=pfc_tvi_key " + ls_Exp + ")")

In earlier versions, this works, and when you do a getitemstring afterward you get a long concatenated value that PFC uses to uniquely identify treeview items.

Such as 'a/r#$%plcy#$%plcy#$%w_m_plcy_fncl_tran#$%a/r#$%'

However, in PB 12.6, only the first portion of the expression is processed. There is no error returned from the Modify function, and the column is created, but the expression is only evaluating one part of the expression. In this partiular case, it results in


I just noticed that this isn't the *first* item in the set of concatenated columns and string literals, which is interesting. In any case, when the computed key values are not correct, the whole method PFC is using to populate and run the treeview falls apart, and you get all children under each parent, and selections on the treeview object do not work properly because the key column values are not unique.

I can copy the expression value from a debugging session, and use that to create a computed column at design time, pasting the expression in, and naming it the same as the created column (pfv_tvi_key), and this then allows the treeview to work properly. However, this is a very cumbersome and problematic workaround. The application has a lot of treeviews, with a very large number of datawindows operating as all the different types of items on different levels of different trees. I don't think it's a practical workaround, and future maintenance would be very difficult.

bu the workaround still demonstrates it is not an issue with the syntax of the compute expression, just an issue with the way it is handled by PowerBuilder when a column is created at run time,vs. at design time.

Has anyone else encountered this issue? I would think there are a fair number of older apps still around that are using PFC treeviews.

My next step will be to install PB 12.6 build 4011 and cross my fingers. Other than that, perhaps try 12.5?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Mar 02, 2015 at 03:55 PM

    Good news! PB 12.6 build 4011 fixed the issue.

    I guess when a release breaks the way PFC works in a very noticeable way (even the current PFC version) then the issue will have already been noticed and possibly fixed.

    It's a little curious, since we *just* installed PB12.6, which involves downloading the current install, that they don't include the patches. Or at least mention them.

    The SAP website is not very user friendly either. Heh.

    Ah well, all's well that ends well.

    I'll take the idea of upgrading the PFC layer under advisement, ti's probably a good idea, but the product I support is in a fairly advanced portion of its life cycle, I'm more inclined to just let that issue lie as it hasn't been causing any problems until now.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      By the way John,

      We recently upgraded to the latest PFC's, from a quit older one.

      Delete your OLD PFC libraries, keep your old PFE's.

      A good way to start is to first get rid of all the errors with "n_cst_platform***" by deleting them.

      (..hpux, ...sol2, ...aix, ...., ...win32)

      Keep only the "n_cst_platformUnicode" and "n_cst_platform"

      The same goes for "n_cst_filesrv*****", keep only the main one and the ..Unicode one.

      Then you might have to copy some of the new PFE objects which didn't exist in the old PFE versoin

      That will give you a lot less errors to get you started with the migration:

      Also, paste the following code in the constructor event of n_cst_platform if you are using 12.6 and not 12.5 of powerbuilder:

      // T3, mjl, 06/01/16: adapt to pb 12.6 instead of 12.5 (see instance vars in ancestor class):


      //string is_separator

      //string is_ClassName[] = {"FNWND3125", "FNWNS3125"} // this is for pb 12.5

      is_ClassName[1] = "FNWND3126" // pb 12.6

      is_ClassName[2] = "FNWNS3126" // pb 12.6



  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2015 at 05:41 PM

    Hi John;

    First and foremost ... you should replace the old PFC layer with the PB 12.6 PFC version. 😉

    FYI: PFC - Home

    However, I see that the highest version on the site is still only v12.5. 😔

    FWIW: I still have issues with PB 12.6 in various areas. All my Canadian government clients are either on PB 12.1 or 12.51 in production and working very well.


    Regards ... Chris

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member John McRaven

      Hi John;

      Your TV issue could be rooted in PB 12.6 and not the PFC. While changing the PFC layer when upgrading is the recommended migration route - you may want to focus on seeing if a migrated PB 12.x. or 12.5.x will work for you first before tackling the PFC migration issue. Just my $0.02.

      Regards ... Chris

  • author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2016 at 07:09 PM

    I am having a similar problem with the treeview. I am using the one from PFC_U_TV also, and when it is rendered at runtime, it just shows the top level. Nothing else, will not expand. It works as it should in the development environment and works as it should with Powerbuilder 11.5.

    I am using PB 12.6 build 4098.

    I went back to build 4081 as it was said it worked in that version. I still have the same issue there.

    I have updated my PFC.

    I do believe a bug has been reported to SAP, but that is not helping me as of now.

    Anybody find a reliable solution?

    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.