Topic
  • 2 replies
  • Latest Post - ‏2019-05-29T18:29:19Z by Christopher Cote
Christopher Cote
Christopher Cote
67 Posts

Pinned topic Trouble using stringOf(integer)

‏2019-05-28T17:28:32Z |

I have an integer variable called numAttr which I fill using the find function.  I then need to change this integer to a string to send it to a function that sets the text within an Excel spreadsheet.  For some reason, though, DXL doesn't like the way I'm using the stringOf function.  Here is the code I'm using:

for obj in currMod do {
    for o in skAttrs do {
        attribName = (string key skAttrs);
        if (obj.attribName"" != "") {
            //Increment the value in the skip list
            if (find(skAttrs, attribName, numAttr)) {
                delete(skAttrs, attribName);
                put(skAttrs, attribName, numAttr++);
            }
        }
    }
}
close(currMod);
//Now print the attribute counts into the spreadsheet
for o in skAttrs do {
    if (!bModNamePrinted) {
        setCell(rowNum, 1, num(itemRef));
        bModNamePrinted = true;
    }
    setCell(rowNum, 2, "Object");
    attribName = (string key skAttrs);
    setCell(rowNum, 3, attribName);
    if (find(skAttrs, attribName, numAttr)) {
        strNumAttr = stringOf(numAttr);
        setCell(rowNum, 4, strNumAttr);
    }
    rowNum++;
}

When I try to run this code, however, I am getting the error: incorrect arguments for function (stringOf) occurring on the first line of the last if-statement.  What am I doing wrong?

 

Chris

  • PekkaMakinen
    PekkaMakinen
    208 Posts
    ACCEPTED ANSWER

    Re: Trouble using stringOf(integer)

    ‏2019-05-28T17:40:13Z  

    For some reason there is no "stringOf(int)" - you just cast the integer to a string by concatenation with an empty string: strNumAttr = numAttr ""

  • PekkaMakinen
    PekkaMakinen
    208 Posts

    Re: Trouble using stringOf(integer)

    ‏2019-05-28T17:40:13Z  

    For some reason there is no "stringOf(int)" - you just cast the integer to a string by concatenation with an empty string: strNumAttr = numAttr ""

  • Christopher Cote
    Christopher Cote
    67 Posts

    Re: Trouble using stringOf(integer)

    ‏2019-05-29T18:29:19Z  

    For some reason there is no "stringOf(int)" - you just cast the integer to a string by concatenation with an empty string: strNumAttr = numAttr ""

    Thank you Pekka.  You would think that they would be consistent with how you do certain things.  I'm assuming that any base types would be done the same way (i.e. int and bool).