Topic
  • 1 reply
  • Latest Post - ‏2019-05-24T18:02:45Z by llandale
Christopher Cote
Christopher Cote
67 Posts

Pinned topic Trouble getting attribute value from object

‏2019-05-24T14:18:12Z |

I'm sure I've done this before, but I'm getting an error now when I try to check the value of an object's attribute, I am getting an error with my code:

currMod = read(modName)
for o in currMod do {
    for attribName is skAttrs do {
        if (o.attribName "" != "") {
            find(skAttrs, attribName, numAttr);
            delete(skAttrs, attribName);
            numAttr++;
            put(skAttrs, attribName, numAttr);
        }
    }
}

The error I'm getting is on line 3 of this block of code.  The error says "null string parameter was passed into argument position 2".  Above this for-loop, I have another for-loop that sets up the skAttrs skip list for all the attributes:

for ad in currMod do {
    if (!ad.system) {
        attribName = ad.name"";
        put(skAttrs, attribName, 0);
    }
}

This error isn't making any sense to me.  Please help this intermediate DXL coder.

 

Chris

  • llandale
    llandale
    3083 Posts

    Re: Trouble getting attribute value from object

    ‏2019-05-24T18:02:45Z  

    the "for variable in SKIP" loop returns the DATA of the Skip, not the "KEY".  In this case you are "put"ting a type "int" (the zero) but retrieving a type "string".

    Here is the standatrd Skip loop:

    int Data

    for Data in skpAttrs do

    {  attribName = (string key skpAttrs)

       use attribName

    }

     

    Also, I don't think it wise to delete from the Skip while in the Skip.  You could just replace it with "put(skiAttrs, attribName, numAttr, true)".

    -Louie