Concatenate fields for textbox value

5 posts, 1 answers
  1. Ryan Emptage
    Ryan Emptage avatar
    28 posts
    Member since:
    Feb 2009

    Posted 04 Feb 2009 Link to this post

    When I concatenate fields for a textbox value, e.g.

    =Fields.MemberTitle1 + " " + Fields.MemberTitle2 + " " + Fields.MemberTitle3 + " " + Fields.MemberTitle4

    if there is no data in one of the fields then nothing displays in the textbox at all.

    why?




  2. Ryan Emptage
    Ryan Emptage avatar
    28 posts
    Member since:
    Feb 2009

    Posted 04 Feb 2009 Link to this post

    I have overcome the problem creating a User Function, BUT this seems a bit over the top just to concatenate a few fields.
  3. DevCraft banner
  4. Answer
    Steve
    Admin
    Steve avatar
    10941 posts

    Posted 04 Feb 2009 Link to this post

    Hello Ryan,

    This is by design. When you have DBNull for one of the fields, the end result becomes undetermined and that is why we consider the whole thing as DBNull. To avoid this, you can use the IsNull built-in function e.g.:

    =IsNull(Fields.MemberTitle1, "") + " " + IsNull(Fields.MemberTitle2, "") + " " + IsNull(Fields.MemberTitle3, "")

    Regards,
    Steve
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Ryan Emptage
    Ryan Emptage avatar
    28 posts
    Member since:
    Feb 2009

    Posted 04 Feb 2009 Link to this post

    ahhh ok, thanks.
  6. David
    David avatar
    1 posts
    Member since:
    Mar 2016

    Posted 21 Mar Link to this post

    Thank you this help me so much
Back to Top
DevCraft banner