Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
5 replies Latest Post - ‏2013-11-26T14:26:43Z by llandale
bandchef
bandchef
21 Posts
ACCEPTED ANSWER

Pinned topic object attribute unknown

‏2013-11-22T14:32:44Z |

Hi!

I get a failure: "unknown object Attribute". I don't know where the mistake is because, I write in the right object. The object is a "global variable".

My code is in the attached file.

 

 

Attachments

  • SudarshanRao
    SudarshanRao
    39 Posts
    ACCEPTED ANSWER

    Re: object attribute unknown

    ‏2013-11-22T14:49:56Z  in response to bandchef

    The error you state indicates incorrect attribute name being specified. Look at the line number specified in the error, verify the spelling of the attribute name used and compare it against the attribute name in the module.

    Alternatively, you could improvise the script to check if the attribute exists before trying to access the attribute in the script using exists perm:

    bool exists(attribute(string attributeName))

    • llandale
      llandale
      2943 Posts
      ACCEPTED ANSWER

      Re: object attribute unknown

      ‏2013-11-26T14:21:05Z  in response to SudarshanRao

      Nit-picks.  Notice the "exists" command presumes the "current Module".  So if you use it then do this 1st:

      • current = m

      Also, "exists" says if the attr exists, but not whether it applies to Objects or not.

      -Louie

  • GregM_dxler
    GregM_dxler
    163 Posts
    ACCEPTED ANSWER

    Re: object attribute unknown

    ‏2013-11-22T16:59:24Z  in response to bandchef

    Hello,

    There are a lot of object attributes used, so SudarshanRao is right, it would be quickest to compare line to the item.

    I don't think the case makes a difference in the name.

    The line number will also give you a clue as to which module the problem is in, your current one or the one the outlink goes to.

    May be also that the target module didn't get opened (access?).

    Seriously, do you have an object attribute called "c_This_is_a"?

    Hope this helps,

    Greg

  • llandale
    llandale
    2943 Posts
    ACCEPTED ANSWER

    Re: object attribute unknown

    ‏2013-11-26T14:11:38Z  in response to bandchef

    did not read your code.  Be advised that every module has attribute "Prefix", but that it is defined for the module only and not for objects.  Therefore, this line of code should get "unknown object attribute" error:

    • string Pref = o."Prefix"

    I suggest therefore that you are accessing some attribute that is not defined for Objects.  Consider the following:

    AttrDef ad

    string Name

    bool ForMod, ForObj

    for ad in (current Module) do

    {  Name = ad.name

       ForMod = ad.module

       ForObj = ad.object

       print Name "\t" ForMod "\t" ForObj "\n"

    }

    Also, this:

    string Name = "MyAttribute"

    AttrDef ad = find(current Module, Name)

    if (null ad) then no such attrobute\

    elseif(! ad.object) then attr not for objects

    else attr available to objects

    -Louie

  • llandale
    llandale
    2943 Posts
    ACCEPTED ANSWER

    Re: object attribute unknown

    ‏2013-11-26T14:26:43Z  in response to bandchef

    Attached find the Attribute screen shots, so you can see what I'm talking about.

     

    Attachments