Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    Sebastiaan Draaisma
    PHP array questionAnswered
    Topic posted December 18, 2018 by Sebastiaan DraaismaBlack Diamond: 60,000+ Points, tagged Connect PHP 
    50 Views, 1 Comment
    Title:
    PHP array question
    Content:

    I have a custom field for accounts (text area) that contains an array. I would like to report on these arrays. I created a report with a custom script in the process section

    // Output array count
    $var = $rows[0][0]->val;
    $array = settype($var, "array");
    $rows[0][1]->val = count($array);

    The thing is... it doesn't count the array content and I've tried a few different things...
    Hardcoding the array does seems to work so I'm not sure what I'm missing.

    // Output array count
    $array = array(1812,1811);
    $rows[0][1]->val = count($array);

    Version:
    18C
    Image:

    Best Comment

    Sebastiaan Draaisma

    Found it :-)

    $var = $rows[0][0]->val;
    $array = explode(',', $var);
    $rows[0][1]->val = count($array);

    Comment