Split delimited string into array

Posted by: seaninglis on 6 August 2023, 8:37 pm EST

    • Post Options:
    • Link

    Posted 6 August 2023, 8:37 pm EST

    Hi,

    Are there any report functions to take a delimited string, split it into an array, and then access one or more elements of that array?

    We have a string in the form “0001.0002.0003.nnnn” and would like to split and process it.

    For the time being we’re just using various Substring calls to extract the parts that we want - always 4 digits in each section - but it still seems a bit clumsy.

    S

  • Posted 7 August 2023, 4:57 pm EST

    Hi Sean,

    Unfortunately, such a function does not exist in ActiveReports. The best possible workaround would be to use the SubString call which you are already implementing.

    Apologies for the inconvenience.

    Regards,

    Anand

  • Posted 7 August 2023, 7:28 pm EST

    Hi, Sean,

    The upcoming release v4.1 will include the custom code functionality that allows invoking your code within an expression. You could use it to process a string in a more efficient manner.

  • Posted 17 August 2023, 8:51 pm EST

    On reflection, I think the lack of a builtin function to split strings to arrays was surprising from a software developer’s perspective, but wouldn’t be to someone who just wants to design reports / the odd power user.

    As a developer you think you must be missing something; as a non-developer you’d just shrug and use Substring.

    We’ll take a look a the custom code when we upgrade to 4.1 though, thanks.

  • Posted 20 August 2023, 4:50 pm EST

    Hi Sean,

    We have attached a sample implementing the Custom Code introduced in ActiveReportsJS v4.1 for your reference.

    You can learn more about the same here Custom Code.

    Hope it helps!

    Regards,

    Anand

    CustomCodeSample.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels