web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

hfunction in Visual Studio to separate string

(0) ShareShare
ReportReport
Posted on by 30

hi all,

i have string like

value   = "1222502-00000023-001-001";

is there any function in Visual Studio to separate string in below format ??

a = 00000023;
b = 001;
c = 001;

i have required this function for SSRS report

please give me more shed on this, 

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    You can use the x++ string functions to achieve that: docs.microsoft.com/.../xpp-string-run-time-functions

    You can use strFind to find a specific character from a string (or from part of a string).

    And you can use subStr to copy a part of a string to another string.

    You need three pieces of code:

    a: All characters after the first "-" and before the second "-"

    b: All characters after the second "-" and before the third "-"

    c: All characters after the third "-"

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi @rp@n,

    There is 'Split' function available in SSRS expressions.

    stackoverflow.com/.../ssrs-expression-to-split-string-possible

    pastedimage1596804718840v1.png

  • @rp@n Profile Picture
    30 on at

    Sergei,

    i have to display in 3 columns the values in below format

    a = 00000023;

    b = 001;

    c = 001

    i have used

    split(Fields!Dimension.Value,"-"),

    but in report it's showing [tag:Error]

    1261.report.jpg

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi @rp@n,

    Have you checked StackOverflow article with examples?

    =Split(Fields!Dimension.Value, "-").GetValue(0) //First value

    =Split(Fields!Dimension.Value, "-").GetValue(1) //Second

    =Split(Fields!Dimension.Value, "-").GetValue(2)

  • @rp@n Profile Picture
    30 on at

    hi Sergei,

    it's work for me

    =Split(Fields!Dimension.Value, "-").GetValue(1) //First value

    =Split(Fields!Dimension.Value, "-").GetValue(2) //Second

    =Split(Fields!Dimension.Value, "-").GetValue(3)

    means here the

    value   = "1222502-00000023-001-001";

    1222502 = 0

    00000023 = 1

    001 = 2

    001 = 3

    So, based on the above expression it's pick the value 1 position value after "-" i.e 00000023  

    rite?

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi @rp@n,

    It's correct.

    Split "Returns a zero-based, one-dimensional array containing a specified number of substrings."

  • @rp@n Profile Picture
    30 on at

    is it possible to remove the values from the column which coming as concatenate. because we already spitted values  in 3 columns

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi @rp@n,

    Probably you can just put empty expression for the column or remove it completely.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans