Alpha Video Training
Results 1 to 12 of 12

Thread: <OBJECT>.TABLE_GET() Error

  1. #1
    Member
    Real Name
    Dan Hooley
    Join Date
    Jan 2008
    Location
    Washington (State)
    Posts
    343

    Default <OBJECT>.TABLE_GET() Error

    Can anyone see why this would produce an error? The second line produces a message box with this error;

    Script:OnPush line: 7
    dim tblp as p = fldp.table_get()
    Object does not support requested interface.
    I am just trying to get a pointer to the table of a given field on a form. I cannot use table.current(), table.get() or table.open() for technical reasons, but according to the help file, this should work. What the help file says is at the bottom. Any ideas?

    Code:
    dim fldp as p = :Entities:CUSTSYSFRECID.this
    dim tblp as p = fldp.table_get()
    msgbox("Test","The name of the table is: " + tblp.name_get(),UI_OK)
    ===================================================================

    <OBJECT>.TABLE_GET()

    Syntax

    <TBL> as P = <OBJECT>.TABLE_GET()

    Description

    The <OBJECT>.TABLE_GET() method applies to:

    *

    Browses (for <OBJECT> use either the <BROWSE> pointer or the name of the browse)
    *

    Browse Columns (for <OBJECT> use the address of the column or a pointer to the column)
    *

    Forms (for <OBJECT> use either the <FORM> pointer or the name of the form)
    *

    Form Controls (for <OBJECT> use the address of the control or a pointer to the control)
    *

    Fields (for <OBJECT> use a pointer to the field)

    The <OBJECT>.TABLE_GET() method returns the <TBL> object pointer to the table that contains the data referenced by the <OBJECT> object pointer.

    Supported By

    Alpha Five Version 5 and Above

    Limitations

    Desktop applications only.

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: <OBJECT>.TABLE_GET() Error

    Are you sure you're using object names in the current layout, as opposed to table and fieldnames?

  3. #3
    Member
    Real Name
    Dan Hooley
    Join Date
    Jan 2008
    Location
    Washington (State)
    Posts
    343

    Default Re: <OBJECT>.TABLE_GET() Error

    Yes, the code is attached to a button on the form.

    You can put this code in a button on one of your forms, and change the first line to your form name and field name, to see what I am talking about.

    Code:
    dim fldp as p = :<formname>:<fieldname>.this
    dim tblp as p = fldp.table_get()
    msgbox("Test","The name of the table is: " + tblp.name_get(),UI_OK)

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: <OBJECT>.TABLE_GET() Error

    Dan, I'm seeing the same thing here, in both vers 9 and 10. Perhaps the issue is that you're using a method designed for pointers to the fields in the table supporting your form with pointers to objects in the form. Notice that in the help file example discussing <object>.table_get() they establish a pointer to the table field, not the field object in the layout, with the following code:

    fld = tbl.first_name.this

    Your "field pointer" is really a pointer to an object in the layout, instead of a pointer to a field in an open table. I'm thinking this may explain what you're seeing.

  5. #5
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: <OBJECT>.TABLE_GET() Error

    Dan, for objects that are bound to table fields it seems that the table name is stored in a property of the layout object. I wonder if something like this would meet your needs:

    Code:
    dim fldp as P
    fldp = :YourFormName:YourfieldName.this  'get pointer to field object in layout
    
    dim tblC as C
    tblC = word(fldP.entry.name,1,"->")  'retrieve tablename from entry property
    
    msgbox("Source Table Name",tblC)

  6. #6
    Member
    Real Name
    Dan Hooley
    Join Date
    Jan 2008
    Location
    Washington (State)
    Posts
    343

    Default Re: <OBJECT>.TABLE_GET() Error

    Tom, thanks for confirming this.

    That's interesting, I did't know about the entry property.

    But what I am really after is a pointer to the underlying table, not just the name of the table. I was only using name for testing.

    And yes, I had noticed that the example used a table field, but here is what the help says:

    Form Controls (for use the address of the control or a pointer to the control)
    Wouldn't you take from that that you could establish a pointer to the control on a form and then using that pointer, get a pointer to the underlying table? Or am I reading something wrong?

  7. #7
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: <OBJECT>.TABLE_GET() Error

    Yes, I think either the docs are misleading (wrong) or the method is not working and should be reported as a bug.

    Having said that it's easy to use the entry property of the field object to get a pointer to the table. Won't something like this get you there?

    Code:
    dim fldp as P
    fldp = :YourFormName:YourfieldName.this  'get pointer to field object in layout
    
    dim tblC as C
    tblC = word(fldP.entry.name,1,"->")  'retrieve tablename from entry property
    
    dim tblp as P
    tblp = table.get(tblC)

  8. #8
    Member
    Real Name
    Dan Hooley
    Join Date
    Jan 2008
    Location
    Washington (State)
    Posts
    343

    Default Re: <OBJECT>.TABLE_GET() Error

    I don't think that will work in my situation, but will check it out for sure.

    I don't know if I can explain this clearly or not. It would work if I was calling it from within the form that has the table I want, as in the example I posted, as would just plain table.get(tablename).

    But I am wanting a method of pointing to a specific instance of an open child table in one form from another form. And both forms have some of the same table names, but in different directories. So table.get() points to the wrong instance depending on which form I call it from. I can get a pointer to the correct form and a pointer to a control on the correct form, but I need a pointer to the correct child table of the form. As in: form pointer->control pointer->table pointer.

    Or is there another way to get a pointer to a specific instance of a table in a form, from outside the form?

  9. #9
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: <OBJECT>.TABLE_GET() Error

    Why all the open forms? Wouldn't it be easier to open the data sources you need without using forms?

  10. #10
    Member
    Real Name
    Dan Hooley
    Join Date
    Jan 2008
    Location
    Washington (State)
    Posts
    343

    Default Re: <OBJECT>.TABLE_GET() Error

    Because the user will be interacting with the forms and the program will be coping data from one form to the other, etc.

  11. #11
    Member
    Real Name
    Dan Hooley
    Join Date
    Jan 2008
    Location
    Washington (State)
    Posts
    343

    Default Re: <OBJECT>.TABLE_GET() Error

    Tom, (and anyone else interested)

    Well, I think I found a solution.

    I put a hidden button on the form that has the tables that I want, and then just "push" that button remotely from the other form, as in; <formname>.<buttonname>.push(). That way the code is called locally and always looks at the correct instance of the table(s). It's working so far, but if anyone has a better idea, please let me know.

    Thanks for your help.
    Dan

  12. #12
    "Certified" Alphaholic
    Real Name
    Cal Locklin
    Join Date
    Mar 2000
    Location
    S.E. Michigan
    Posts
    5,763

    Default Re: <OBJECT>.TABLE_GET() Error

    Try this:

    <form_name>:tables:<table_name>.<fieldname or this>

    That should give you pointers to the specific session for the specified <form_name>.

    These examples are from my Interactive Window. My "Menu_main" form is based on a table named "menus" and has one field named "junk" that contains the value "j". (If there isn't at least one record in the table, then every time you open the form, the form will go into Enter mode. I haven't seen any problem with that - I just don't like the concept so I make sure there is always one record in the table even though it's just "junk".)

    ?Menu_main:tables:menus.junk
    = "j"

    DIM tp as P
    tp = Menu_main:tables:menus.this
    ?tp.junk
    = "j"

Similar Threads

  1. Error help- Could not open OLE object
    By vinyltap in forum Application Server Version 9 - Web/Browser Applications
    Replies: 3
    Last Post: 11-02-2009, 02:04 PM
  2. Table_get() in set
    By Michael Humby in forum Alpha Five Version 9 - Desktop Applications
    Replies: 21
    Last Post: 10-02-2008, 08:34 AM
  3. Bad Object Error?
    By jas102 in forum Alpha Five Version 7
    Replies: 1
    Last Post: 01-03-2008, 10:02 PM
  4. Conditional Object Error
    By Elke in forum Alpha Five Version 6
    Replies: 5
    Last Post: 01-31-2005, 06:44 AM
  5. Object does not exist error
    By Amateur in forum Alpha Five Version 5
    Replies: 9
    Last Post: 01-26-2005, 12:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •