Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Migration Problem

Posted on 2004-04-06
Medium Priority
Last Modified: 2013-12-26
Earlier I asked a question here for migration. Thanks for all those answers.

Now I am fixing the migration issues. The approach I followed is, copied PB9 PFC pbls into my application overrding the PB6.5 PFC's. Then migrated. Faced a very few problems on obsolete funcs. Fixed all of them but one problem I am not able to understand. In one of the application pbl's it is calling n_cst_string.of_parsetoarray() function. Migration gave "Misused Type : n_cst_string" on this line.

I checked up the n_cst_string object in both versions. There are no differences. The argument types are also same in both versions. The last one being a reference variable.

The syntax present in my object is n_cst_string.of_parsetoarray(ls_upcstring, ",", ls_upc_array[]). I do not understand in what way to fix it.

Can anyone please help. Very urgent as I have to send a migrate report today.
Question by:Meena_kumari
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
LVL 14

Expert Comment

ID: 10772456
1) just replace your code with declaring a variable and check

n_cst_string    inv_string
inv_string.of_parsetoarray(ls_upcstring, ",", ls_upc_array[])

variable declaration will be private or instance or globle according to your requirement.

2) also confirm that nowhere else (in other pbls of the library list), the same object (n_cst_string) is there and having different defination. but i think this will not be the case.

check with first solution.
LVL 14

Accepted Solution

sandeep_patel earned 1500 total points
ID: 10772544
oh no,
i think following is the problem

in your function calling replace ls_upc_array[] by ls_upc_array

so it will be

n_cst_string.of_parsetoarray(ls_upcstring, ",", ls_upc_array)


Author Comment

ID: 10772761
Hi Sandeep,
Thanks for the answers. I tried both options earlier itself.
The first option we cannot do because it is an autoinstantiate class, and doesn't require a variable declaration of its type. The second option, The original code was having no brackets after ls_upc_array. I tested it with brackets. Both din't work.

Now I am planning to temporarily comment the code, migrate, and uncomment in PB9, see what happens. Let me try this out.

Meanwhile if you can think of any other solutions please post them. Thanks alot.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 14

Expert Comment

ID: 10773010
ya, commenting the code will definately work.

although can u post entire script here?

Author Comment

ID: 10773098
Sandeep, please find the script here.

// Script for n_cst_proc_fndg_b120.of_updateprdvariant event.
// Arguments:
//            None
// Return: (integer)
//            1      -      Cancel/Error
//            0      -      Continue
// Description:
//            Loads the product variant table.

long ll_maxrows, ll_row, ll_upper, ll_cnt, ll_vnpk_qty
string ls_upc, ls_cb_ent_id, ls_cb_role_id, ls_upc_array[], ls_upc_null[]
string ls_itemnumber, ls_new_upc
boolean lb_upc_fnd

//default vnpk_qty
ll_vnpk_qty = 1
DECLARE UPDT_PRD_VARIANT PROCEDURE FOR FNDG_UPDT_PRD_VAR(:ls_cb_ent_id, :ls_cb_role_id, :ls_itemnumber, :ls_new_upc, :ll_vnpk_qty);

ll_maxrows = ids_variant.RowCount()
FOR ll_row = 1 to ll_maxrows
      ls_upc = ids_variant.Object.upc[ll_row]
      ls_cb_ent_id = ids_variant.Object.cb_ent_id[ll_row]
      ls_cb_role_id = ids_variant.Object.cb_role_id[ll_row]
      ls_itemnumber = ids_variant.Object.variant_nbr[ll_row]
      ls_upc_array = ls_upc_null
      n_cst_string.of_ParseToArray(ls_upc, ',', ls_upc_array)
      ls_new_upc = this.of_getupc(ls_upc_array)
return 1
LVL 14

Expert Comment

ID: 10773269
your script is problem... I copied it to my application with commenting procedure and the line

ls_new_upc = this.of_getupc(ls_upc_array)

it's compiled OK...have u checked with comment ? Are u sure that n_cst_string.of_parsetoarray(ls_upc,',',ls_upc_array) is the only line that causing the problem ?

Expert Comment

ID: 10773506
Well to me, This kind of code gives me warning : Undefined Variable :n_cst_string
I am surprized it's working for you.... Check you don't have variabled declared as :

n_cst_string n_cst_string

( if not, you can try decaring, may work but it's not the proper way..)

This is not the correct way to call function.. Even if n_cst_string is autoinstantiate, you need to declare a variable of that type and call metods on that variables. These methods are not Static mathods ( so that you can refer them by the Class..)
Auto Instantiate means you need not call create and destroy, and some difference in memory allocation..



Expert Comment

ID: 10773518
Normally in a PFC app, String service will be delared as an instance variable of the app mager, and you will call functions as :

gnv_app.inv_string.of_ParseToArray(ls_upc, ',', ls_upc_array)


Expert Comment

ID: 10773631
Well, lots of information above, but here is the gist of the problem: Trying to use a "class" function. Class functions are not supported in PowerBuilder, but most versions let you call them anyway, and sometimes they even work. Most of the time though, they cause the application to die. Like the first person said, changing the call to this will solve the problem:

n_cst_string lnv_string
string ls_upcString, ls_upc_array[]

lnv_string.of_parseToArray (ls_upcString, ",", ls_upc_array)

Note two important changes: Removal of the [] in the function call, and replacing n_cst_string with a local variable of type n_cst_string.

Author Comment

ID: 10773763
Hi, Thanks to all.

As I said, I migrated with commenting that piece of code, opened that object in PB9, declared local variable of type n_cst_string and called the function with that variable.
This got compiled without problems.

Thanks for all, I agree with all of your options.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question