1. Tracy Lamb
  2. PowerBuilder
  3. Friday, 2 July 2021 14:04 PM UTC

I have a universal datawindow userobject... u_dw.

Inherited a new object u_dw_attachments

Added a user function of_setworkorder( al_workorder )

In script, when I try to call that function, I get a compiler error. Here's my script:

idw_attachments.of_setworkorder(il_workorder)

Here's the error:

C0051: Unknown function name: of_setworkorder

The function is public

Any idea what's causing this error?

TIA,

Tracy

 

Accepted Answer
David Vasconcelos Accepted Answer Pending Moderation
  1. Friday, 2 July 2021 17:25 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Terry based on what you mentioned. Your idw_attachments is declared from the wrong object.

Assuming I am understanding what you wrote..

You have an existing object u_dw, you then created a new object u_dw_attachments which was inherited from u_dw.

You added a new function of_setworker in u_dw_attachments.

when you declared idw_attachments you used u_dw,

as stated above

u_dw idw_attachments

so idw_attachements is now u_dw and not u_dw_attachments so the new function does not exist, 

You may have wanted to use

u_dw_attachements idw_attachments

which then would give you u_dw and u_dw_attachments access..

Assuming I understood you correctly.

Dave V.

 

Comment
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Friday, 2 July 2021 19:25 PM UTC
  2. PowerBuilder
  3. # 1

Thank you for taking the time to reply! Another user provided the solution... just change the instant object declaration type from u_dw to u_dw_attachments so I can have access to all u_dw functionality as well as u_dw_attachments additional functionality.

Comment
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Friday, 2 July 2021 19:19 PM UTC
  2. PowerBuilder
  3. # 2

Thank you! Thank you! Thank you!

That fixed the problem!

~~~Tracy

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 2 July 2021 16:35 PM UTC
  2. PowerBuilder
  3. # 3

Hi, Tracy -

Objects inherited from u_dw will only have access to the public/protected methods (functions) and properties (instance variables) in u_dw or its ancestor(s). The of_setworkorder function doesn't exist in u_dw... you created it in a descendant of u_dw named u_dw_attachments. This is why the compiler cannot find this function.

You need to replace the desired u_dw user object(s) with a u_dw_attachments user object in the window/tab page in order to be able to invoke the of_setworkorder function.

I strongly recommend you create a backup copy of the window or tab page user object(s), and/or export the window  or tab page user object(s) before making this type of change, particularly if you have not previously performed similar tasks.

Best regards,
John

Comment
  1. Miguel Leeuwe
  2. Friday, 2 July 2021 17:14 PM UTC
Hi John, exactly what I was trying to say.

regards
  1. Helpful
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Friday, 2 July 2021 15:54 PM UTC
  2. PowerBuilder
  3. # 4

They type is u_dw ... this works with all the other dw objects... u_dw_attachments inherits from u_dw... all the other dw instances also inherit from u_dw

// Use instance variables for easy reference to
// the tab pages, and DWs on tab pages...
u_dw idw_workorder
u_dw idw_datasheet
u_dw idw_standards
u_dw idw_certificate
u_dw idw_maintenance
u_dw idw_parts
u_dw idw_timesheet
u_dw idw_notes
u_dw idw_history
u_dw idw_attachments
u_dw idw_CurrentDW

UserObject itabpage_workorder
UserObject itabpage_datasheet
UserObject itabpage_standards
UserObject itabpage_certificate
UserObject itabpage_maintenance
UserObject itabpage_parts
UserObject itabpage_timesheet
UserObject itabpage_notes
UserObject itabpage_history
UserObject itabpage_attachments

Comment
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Friday, 2 July 2021 15:45 PM UTC
  2. PowerBuilder
  3. # 5

u_dw

 

// Use instance variables for easy reference to
// the tab pages, and DWs on tab pages...
u_dw idw_workorder
u_dw idw_datasheet
u_dw idw_standards
u_dw idw_certificate
u_dw idw_maintenance
u_dw idw_parts
u_dw idw_timesheet
u_dw idw_notes
u_dw idw_history
u_dw idw_attachments
u_dw idw_CurrentDW

UserObject itabpage_workorder
UserObject itabpage_datasheet
UserObject itabpage_standards
UserObject itabpage_certificate
UserObject itabpage_maintenance
UserObject itabpage_parts
UserObject itabpage_timesheet
UserObject itabpage_notes
UserObject itabpage_history
UserObject itabpage_attachments

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 2 July 2021 14:53 PM UTC
  2. PowerBuilder
  3. # 6

are you sure your instance variable "idw_attachments" is of type "u_dw_attachments" and not maybe "u_dw"?

regards

Comment
  1. Tracy Lamb
  2. Friday, 2 July 2021 19:27 PM UTC
Sorry... I missed this comments... that was the correct answer. Thank you for taking time to reply. Rookie mistake!
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 3 July 2021 01:14 AM UTC
np Tracy, glad it's working now. (to be fair, Mike S already asked you about the type before my comment)

:)
  1. Helpful
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Friday, 2 July 2021 14:16 PM UTC
  2. PowerBuilder
  3. # 7

The datawindow userobject is on a tabpage userobject, and the tabpage userobject is in a tab object in the window I'm working on. Here's the code for the SelectionChanged event on the tab:

CASE itabpage_attachments
idw_CurrentDW = idw_attachments
idw_attachments.retrieve(il_workorder)
idw_attachments.of_setworkorder(il_workorder)
ls_topic='Workorder Attachments'
END CHOOSE

 

 

Comment
  1. mike S
  2. Friday, 2 July 2021 15:05 PM UTC
what type is idw_CurrentDW?
  1. Helpful
There are no comments made yet.
Matt Balent Accepted Answer Pending Moderation
  1. Friday, 2 July 2021 14:08 PM UTC
  2. PowerBuilder
  3. # 8

And you put the inherited object on the form / object you have the script in?

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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.