1. Daryl Foster
  2. PowerBuilder
  3. Wednesday, 8 November 2017 05:32 AM UTC

Hi Everyone,

I'm working on migrating our PB 10.5 COM Object to a PB2017 .Net Assembly but I've had a problem with objects that are dynamically created with the "objectvariable = CREATE USING objecttypestring" syntax.  It can't seem to find the objecttypestring and returns a null object.  Is this syntax supported for .Net Assembly targets?

For example, the following type of code won't work (not real code obviously):

 

string ls_type = 'n_svc_string'
userobject lnv_object

lnv_object= create using ls_type

 

but this code will work:

 

string ls_type = 'n_svc_string'
userobject lnv_object

choose case ls_type
    case 'n_svc_string'
        lnv_object= create n_svc_string
    case 'n_svc_something_else'
        lnv_object= create n_svc_something_else
end choose

 

Does anyone know if the "create using" syntax is supported when deploying to a .Net assembly?

 

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 15 November 2017 16:39 PM UTC
  2. PowerBuilder
  3. # 1

The second way probably works, because you have a "Fixed" reference to you object, which is then detected and compiled.

If you only have a reference to the object as the contents of a string variable, the compiler doesn't pick it up.

You have to declare it somewhere as a variable or put the reference in a .PBR file.

HIH

Comment
  1. Daryl Foster
  2. Thursday, 16 November 2017 06:30 AM UTC
Thanks Miguel, I thought it might be something similar so I added a variable of the various types and I even added them as NVOs to the object just so the reference was baked in but I still couldn't get the "create using" syntax to work.  I think I can just work around it for now using the static object reference.

  1. Helpful
  1. Miguel Leeuwee
  2. Thursday, 16 November 2017 20:40 PM UTC
Okay, but sounds like a bug to me then.



Cheers

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.