1. Michael Skinner
  2. PowerServer 2020 or older (Obsolete)
  3. Tuesday, 26 November 2019 15:43 PM UTC

 

I have code that creates objects dynamically with the "CREATE USING" statement . It does not seem to work. I am not seeing any place where it says it not supported.  Do  need to make code change to get this to work?

All I am doing is:

lnv_object = CREATE USING as_object_name

I am checking right after to see if it created and it not. 

Thanks for your assistance.

 

Ricardo Jasso Accepted Answer Pending Moderation
  1. Tuesday, 26 November 2019 22:56 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 1

Michael,

If you are absolutely certain that as_object_name contains the proper user object name then it must be that the runtime cannot find the resource. Try adding the user object to the resource file when building the executable. Or choosing "create pbd" in the application project. I have to do this for dynamically referenced datawindow objects by datawindow controls. Maybe it also applies for user objects.

Regards,

Ricardo

 

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 27 November 2019 00:23 AM UTC
Hi Ricardo;

A good thought for native PB App but not in the case of PowerServer. The only way that could happen is if the PBL of the dynamic NVUO is not in the Web Apps deployment list. PB objects get converted to Java classes in PS apps.

Regards ... Chris
  1. Helpful
  1. Ricardo Jasso
  2. Wednesday, 27 November 2019 00:44 AM UTC
That's what I was not sure about since I don't use PowerServer. I thought it might use a schema similiar to the creation of web services using PowerBuilder where a PB Runtime needs to be deployed in the web server. Thanks for the clarification.



But could it be that even if the PBL is in the deployment list PowerServer is not including the object because it is not referenced statically? Is there a resource file PowerServer uses when converting to Java classes that could be used to make sure the user object is included in the conversion process?
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 26 November 2019 19:01 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 2

Hi Michael;

   FWIW: I have been using the "Create Using" command in my frameworks for ages and have also been using this feature in PowerServer  Web / Mobile Apps since 2008.

HTH

Regards ... Chris

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 26 November 2019 17:45 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 3

what version of powerserver are you using?

 

i have code like the following that works:

choose case ls_dbms_style
    case inv_database_type.const_oracle
         ls_objectname = 'nv_attachment_oracle'

    case else //is_mssql, is_sqlanywhere, is_sybase
       ls_objectname = 'nv_attachment_sqlserver'

end choose

if ls_objectname > '' then
    lnv_attach = create using ls_objectname
end if

Comment
  1. Michael Skinner
  2. Tuesday, 26 November 2019 17:48 PM UTC
PowerServer (PB Edition) 2019 Build 2082.00
  1. Helpful
  1. mike S
  2. Tuesday, 26 November 2019 19:35 PM UTC
the 2019 version i am using is a bit newer:

PowerServer (PB Edition) 2019 Build 2151.00



i have not used 2082, but i have used various version of 2016, 2017, etc.



are you sure you didn't include a space in the string? or maybe spelled the object name incorrectly?





  1. Helpful
  1. Michael Kramer
  2. Thursday, 28 November 2019 21:04 PM UTC
Hey Michael, Did you find a solution?

My laptop lost its screen so I'm in darkness or typing on phone. Outside warranty. Only good thing: Black Friday in a few hours - but darn didn't plan on laptop upgrade right now.

Could be a week or two before I'm fully operational again here at the Q&As.
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 26 November 2019 16:19 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 4

yes, it works in powerserver web.  I have used it in pretty much all versions of PS web

Comment
  1. Michael Kramer
  2. Tuesday, 26 November 2019 16:39 PM UTC
Are you missing a PBL in your library list? CREATE USING keeps the compiler from ensuring the string identifies a class available at runtime.
  1. Helpful
  1. Michael Skinner
  2. Tuesday, 26 November 2019 17:34 PM UTC


if I add a case statement and create the object without USING - no problem



choose case as_object_name

case 'n_cst_sysuser'

lnv_object = CREATE n_cst_sysuser // OK

case else

lnv_object = CREATE USING as_object_name // NOT OK

end choose
  1. Helpful
  1. Michael Kramer
  2. Tuesday, 26 November 2019 17:52 PM UTC
That is certainly unexpected behavior.
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Tuesday, 26 November 2019 16:15 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 5

Not sure in PowerServer but in regular PowerScript all continues to be fine. Also in PB 2019 R2. Last time I executed CREATE USING was late yesterday. But I guess your issue is whether PowerServer Web has issue.

Comment
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.