Concatenate fields with comma

Hi Friends
How to write a expression to achieve the following task in SSRS:
Col_1 
Col_2 
Col_3 
Col_4
  A           B        NULL    
D
  A         
 B          C      
NULL
To       
A, B, C
A, B, C
I wrote a expression like this: =Fields!Col_1.value & "," & Fields!Col_2.value & "," & Fields!Col_3.value
& "," & Fields!Col_4.value
and I'm getting result like this: A, B, , D (as
Col_3 is NULL)
       A, B, C, (getting
comma after C as Col_4 is NULL).
Royal Thomas

you can make expression like this
=Fields!Col_1.value & IIF(Len(Fields!Col_2.value) = 0 ,"","," & Fields!Col_2.value) & IIF(Len(Fields!Col_3.value) = 0 ,"","," & Fields!Col_3.value) & IIF(Len(Fields!Col_4.value) = 0 ,"","," & Fields!Col_4.value)
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Form field with comma delimited value list to cfc

    I have a form that passes a field to an action page with a
    comma delimited value.
    For instance the field name is: Program_ID
    value for program_ID is: 31, 32
    I am able to treat this variable as a list and check its
    length, and loop over the list prior to passing it to a cfc using
    the attached code:
    When I try and pass the variable as a string to a cfc and
    invoke a query, cf no longer recognizes my var as a list.
    Therefore the code attached does not function...
    Is there a specific var type that will pass through as a list
    and allow me to run the code block attached?
    thanks
    Craig

    Ok answered my own question.. Here is the answer for those
    who are interested...
    initialize var for cfc in cfinvoke statement
    <cfinvokeargument name="Program_ID"
    value="#Form.Program_ID#">
    pass argument to cfc as a string
    <cfargument name="Program_ID" type="string"
    required="true">
    use listqualify to parse list in cfc and set new var
    <cfset selectedProgramID =
    ListQualify(Program_ID,"'",",","CHAR")>
    use the new var in the following statement in sql code:
    ((Program_ID) IN (#PreserveSingleQuotes(selectedProgramID)#))
    The following code handles a form field with a single value
    or a comma delimited value.

  • Concatenate fields using commas

    How do I concatenate fields using proper English separators? I'm using Acrobat Pro X.
    I have fields named Field1, Field2, Field3, Field4 and Result.
    Example 1
    In Field1, I enter Apples. In Field2, Oranges. The other two fields are empty (Null).
    In the Result field it returns "Apples and Oranges."
    Example 2
    I add Grapes in Field3.
    The Result field returns, "Apples, Oranges, and Grapes."
    Example 3
    I add Pears to Field4,
    The Result should be,  "Apples, Oranges, Grapes, and Pears."
    Any help is appreciated.

    The script for this will be scaled up to ten total fields once complete and will only contain consecutively filled fields. This is what I have currently. It uses a separate field for the conjunction and obviously leaves the remaining commas and the end of the returned result.
    var a=getField(“Field1”).valueAsString
    var b=getField(“Field2”).valueAsString 
    var c=getField(“Field3”).valueAsString 
    var d=getField(“Field4”).valueAsString 
    var e=getField(“Field5”).valueAsString 
    var f=getField(“Field6”).valueAsString 
    var g=getField(“Field7”).valueAsString 
    var h=getField(“Field8”).valueAsString 
    var i=getField(“Field9”).valueAsString 
    var j=getField(“Field10”).valueAsString 
    var sep=getField(“separator”).valueAsString; 
    if(sep.length>=1) 
    {event.value=a+sep+ b+sep+ c+sep+ d+sep+ e+sep+ f+sep+ g+sep+ h+sep+ i+sep+ j+sep}
    Else event.value +””;

  • Displaying data from a list into a single field with comma separated values

    Hi,
    I have a requirement to change a report with an XML structure (simplified version) as below
    <Protocol>
    <ProtocolNumber>100</ProtocolNumber>
    <SiteName>Baxter Building</SiteName>
    <ListOfActivity>
    <Activity>
    <Description>Communication Memo Description.</Description>
    <Name>James</Name>
    </Activity>
    <Activity>
    <Description>Visit 4</Description>
    <Name>James</Name>
    </Activity>
    <ListOfActivity/>
    </Protocol>
    On the report I need to display all the 'Names' for each of the Child (Activities) in a single field at the Parent (Protocol) level, with each Name separated by a comma.
    How do I go about getting this to work?
    Thanks

    Take a look at this: http://blogs.oracle.com/xmlpublisher/entry/inline_grouping
    You could do this (ofcourse, you will need to add extra logic to ensure that there is no comma added after the last name..)
    <?for-each@inlines:Name?><?.?><?', '?><?end for-each?>
    Thanks,
    Bipuser

  • SQL to match a single value in a field with comma-delimited text

    I have a column that can contain none, one or many recordIDs
    (from another table) stored as comma-delimited text strings (i.e.,
    a list). I need to retrieve all records that match a single value
    within that list.
    For example, if I want to match all values that equal
    recordID 3, and I use ... WHERE MyColumn IN ('3') ... , I will get
    all records that have EXACTLY 3 as the value of MyColumn, but not
    any MyColumn records whose values include 3, if they are instances
    such as "3,17" or the like.
    Also using the LIKE operator -- as WHERE MyColumn LIKE '%3%'
    -- will get me unwanted records with values such as 35 or 13 ...
    Can I use some sort of intervening ColdFusion list processing
    to output only the desired records?

    Normalize your database so that your data becomes
    accessible.

  • Concatenate fields with doc number

    HI
    In cv01n tcode in second tab ADDITIONAL data we have 3 inputs -category,sub category and sub type . now i need to concatenate these three when document no is created .
    doc number generation i created but how to concatenate these 3 filds and displayed when clicked saved button. Those 3 fields of type char.
    please help me out . automatic doc no is generating i wrote tht in stndard program zmcdokznr ..help me in writing the code to concatenate these 3 fields .
    THANKS in advance

    Hi,
    DATA:LV_FLD1 TYPE STRING,
              LV_FLD2 TYPE STRING,
             LV_FLD3 TYPE STRING.
    DATA:LV_FINAL TYPE STRING.
    LV_FLD1 = category,      "CATAGORY INPUT VALUE.
    LV_FLD2 = sub category "SUB CATEGORY VALUE.
    LV_FLD3 = sub type  "SUB TYPE VALUE.
    IF DOUCMENT NUMBER IS CREATED.
    CONCATENATE LV_FLD1 LV_FLD2 LV_FLD3 INTO LV_FINAL.
    ENDIF.
    regards,
    muralii.

  • Field with comma separated values to be split into Rows using a Query

    Thanks for the Reply.. I also have to Decode each of the spilt values with some text..
    replace(disc_topics,',',chr(10)) A from XYZ
    Disc_topics values are '01,02,03,04,05'
    this has to be done in SQL
    01 Test1
    02 Test2
    03 Test3
    04 Test4

    select replace( replace( replace( replace( '#' || '01,02,03,04,05,10,11', ',', ',#'), '#0','#'),'#','Test'),',',chr(10)) A from XYZ

  • How to store a file in application server with comma as a delimiter !!

    <i>Hi,
       I'm Creating a file in app. server using "open dataset" statment and populating the file using Transfer stmt.
    I like to store the data fields with comma delimiter, since it normally fixed length.
    Please let me know Any method available.
    Thank You,
    Senthil</i>

    No problem,  just concatenate all your fields into one field separated by a comma.  Then transfer that field only.
    data: your_dataset type localfile default '/usr/sap/TST/SYS/Data1.txt'.
    data: output type string.
    open dataset your_dataset for output in text mode.
    loop at itab.
      concatenate itab-fld1
                  itab-fld2
                  itab-fld3
                       into output separated by ','.
      transfer output to your_dataset.
    endloop.
    close dataset your_dataset.
    REgards,
    Rich Heilman

  • Combining rows with comma delimited

    Hi All,
    I have two tables
    Table A
    ID Location ID
    1 6
    2 7
    1 9
    2 10
    3 7
    1 8
    2 9
    Table B
    ID
    1
    2
    3
    49
    8
    6
    I have to come up with something like this for each ID in table B, I have to write a query to get
    ID Location ID
    1 6, 9, 8
    2 7, 10, 9
    so for each Id I need to grab there Location Id and concatenate them with comma.
    How can I acheive this. Is it possible to avoid loops in this case?
    Anye help will be apprecaited.

    with a as (
               select 1 id,6 location_id from dual union all
               select 2,7 from dual union all
               select 1,9 from dual union all
               select 2,10 from dual union all
               select 3,7 from dual union all
               select 1,8 from dual union all
               select 2,9 from dual
         b as (
               select 1 id from dual union all
               select 2 from dual union all
               select 3 from dual union all
               select 49 from dual union all
               select 8 from dual union all
               select 6 from dual
    -- end of on-the-fly data sample
    select  id,
            rtrim(xmlagg(xmlelement(e,location_id,',').extract('//text()') order by rn),',') location_id_list
      from  (
             select  a.id,
                     a.location_id,
                     row_number() over(partition by a.id order by a.location_id) rn
               from  a,
                     b
               where b.id = a.id
      group by id
            ID LOCATION_ID_LIST
             1 6,8,9
             2 7,9,10
             3 7
    3 rows selected.
    SQL> SY.

  • Currency with Comma -- Unable to multiply

    Hi all
       I am having a Amount Field(with comma as Unit separator like 1,010) saved in Char Field. Now I neeed to multiply this Amount Field with X number.
    When there is no comma (like 300.00), then amount is succeesfully multipled but when I have amount 1,010(having comma), it short dumped !
    How to over come this issue ?
    Thanks

    Hi,
    Try like this:
    data: amt(10) type c,
          l_amt(10) type n.
    amt = '1,200'.
    move amt to l_amt.
    l_amt = l_amt * 250.
    write:/ amt,
          / l_amt.
    Regards,
    Bhaskar

  • Data Merge, description field data with comma in text

    I work with Data Merge, but my description field data have comma in text, occurring a problem when load to Indesign, when i exclud de field description with comma the action occur perfectly. Have solunction to this?

    Hi Peter, i dont have problems with =concatenate on excel, and i think who you formula is wrong. i use exactly =CONCATENAR(A2&","&B2&","&C2) and works perfectly.
    My problem is with commas in texts, see comma B2
    indesign recognizes it as the delimiter and wraps the text to another field, ok?
    i use quotes  eg: B2( "Dias melhores, para sempre")  to delimiter text like the example
    when I load the data source InDesign does not recognize the quotes and breaks lines
    the text  "Dias melhores, para sempre" have to show on <<slogan>> but

  • Currency field to be displayed with commas and asterisks(formatting)

    I have a field REGUH-RWBTR in my sap script code. I need to have the currency displayed with commas. And also if the digits are less, then left pad it with asterisks for remaining spaces.
    For eg, If the Digit is 12345678912.23 (max value), it should print as 12345,678,912.23.
    And If the digit is 12345.89, it should print as ******12,345.89
    Please help me to solve this problem.Its urgent.
    Thanks,
    Sandeep.

    Hello,
    You can use the WRITE using EDIT MASK.
    USING { {NO EDIT MASK}|{EDIT MASK mask} }
    Effect
    This addition overrides a conversion routine defined through reference to the ABAP Dictionary. The addition NO EDIT MASK only switches off the execution of an assigned conversion routine. The addition EDIT MASK calls either another conversion routine or defines an edit mask. For mask, a data object of the same name is expected.
    In order to call an arbitrary conversion routine CONV, mask must contain two equals signs, followed directly by the name of the conversion routine: "==CONV". During output, the content of dobj is passed to the function module CONVERSION_EXIT_CONV_OUTPUT, converted there, and then the result is displayed. If the function module is not found, an exception that can be handled is triggered (as of Release 6.10). The statement DESCRIBE FIELD contains an addition in order to fill mask accordingly.
    If the output length is specified explicitly with len, the conversion routine is executed for the specified length; otherwise for the implicit output length. If * or ** is specified for the output length, the appropriate rules are used for the converted result.
    If the first two characters in mask are not equals signs, the content is interpreted as an edit mask in which some characters have a particular meaning. The WRITE statement does not then output the content of dobj directly, but the character string in mask as follows:
    If the first two characters in mask are "LL" or "RR ", these are not output, They control whether the edit mask is left-justified or right-justified. If the first two characters are other characters, the edit mask is left-justified.
    All "_" characters are replaced from the left (in the case of "LL") or from the right (in the case of "RR") with characters for character-type types or numbers for the types p or i from dobj. In the case of fields of type c, closing blanks are ignored. Data objects of type f or x are converted into type c before editing. Superfluous characters "_" in mask are replaced by blanks. Characters from dobj for which there are no characters "_" in mask are not displayed.
    If dobj is of type i or p, the first character from the left "V" in mask is replaced with "-" in the case of a negative number and by blank in the case of a positive number.
    All the other characters of the edit mask are displayed unchanged.
    If no output length is specified, the implicit output length of dobj is used. If len is specified for the output length, the value of len is used. If * is specified for the output length, exactly that length that is required for the list display is set. If, in Unicode systems, characters of the edit mask are replaced by characters that take up more than one column on the list, the output length is increased accordingly and the output is filled with blanks in the list buffer. If ** is specified for the output length, double the length of the edit mask mask is used.
    If other formatting options are specified concurrently for an edit mask, these are used first and then the special characters in the edit mask are replaced by the interim result. The date masks date_mask are an exception to this. If these are specified, the edit mask is ignored.
    Notes
    In Unicode systems, you must remember that a character "_"in the edit mask does not necessarily correspond to a column in the list display since the space required in the display depends on the character to be replaced.
    The minus sign for a negative number is not displayed if no edit character "V" is specified. The decimal separator of a packed number with decimal places must be specified at the required position in the edit mask.
    Example
    Edited output of time duration. In the first output, the function module CONVERSION_EXIT_DURA_OUTPUT is executed. This converts the duration specified in seconds into minutes. In the second output, the edit mask is output according to the above rules. However, the underscore characters "_" are replaced by the characters from time.
    DATA: dura TYPE i,
          time TYPE t VALUE '080000'.
    dura = sy-uzeit - time.
    time = dura.
    WRITE /(30) dura USING EDIT MASK '==SDURA'.
    WRITE /(30) time USING EDIT MASK
                           'RRThe duration is __:__:__'.
    Regards,

  • How to compare table's date field with dropdown year field

    Hi All,
    I have one requirement to display the selected rows from a database table based on the selection of drop down.
    Here, I have one dropdown of year(like 2009,2010,....) and I have one database table which contains one field with "DATE".
    Now, I want to compare table's DATE field with my dropdown field.
    Problem is that table's DATE field is of type "DATS" and dropdown is of type INTEGER(or) STRING ...
    How to compare this fields?
    Can any one please give me solution for this...!
    Thanks in Advance!

    Hi  sreelakshmi.B,
    try the following:
    DATA lt_dats        TYPE TABLE OF dats.
    DATA l_dat_i        TYPE          i.
    DATA l_dat_c_4(4)   TYPE          c.
    DATA l_dat_c_12(12) TYPE          c.
    DATA l_dats_from    TYPE          dats.
    DATA l_dats_to      TYPE          dats.
    *Move Date from Integer to Char
    l_dat_c_4 = l_dat_i = 2005.
    *Create Date From use in WHERE-Clause
    CONCATENATE '01.01.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_from
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    *Create Date To use in WHERE-Clause
    CONCATENATE '31.12.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_to
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    * Select records in range
    SELECT *
           FROM [DBTAB]
           INTO TABLE [ITAB]
           WHERE [DATE] BETWEEN l_dats_from
                        AND     l_dats_to.
    Regards
    REA

  • Struggling with Comma for an amount in sap script

    Hi Experts
    I am strugling with comma for an amount in sap script .
    For ex: 1234.56  and i need 1,234.56
    I tried  system->userprofile->owndata->Default(Tab)->Decima Notation 1,234,567..89(Selected)
    and i did use /:Edit Mask Field name  but i am not getting comma.
    Thanks & Regards
    Reddy

    Hello,
    In the driver program, assign the amount to a variable of type P and use that variable to display in the script. You will get the commas.
    Vikranth

  • Concatenate fields of record  type

    Hi
    Is there some way to concatenate fields of the record type ?, example
    declare
    TYPE customer_sales_rectype IS RECORD
          (campo1 char(3),
          campo2  char(3),
          campo3  char(3));
      TYPE ZZZ IS RECORD (kkk customer_sales_rectype);
          x customer_sales_rectype;
    begin
      x.campo1:='000';
      x.campo2:='aaa';
      x.campo3:='BBB';
    end;I have a table
    ID_REPORT NUMBER                                  
    ID_LINE     NUMBER                                  
    DT_FILE  DATE           Y                        
    DS_LINE     VARCHAR2(2048) Y        My quey have more than 50 columns and must to concatenate columns, example:
    select column001 ,
           ';' PV1,
           COL2,
           COL3
           COL4,
         ';' PV2,....ETC
    FROM MY TABLESI think moving result of query into variable of record type I would can insert into table in column DS_LINE doing some transformatcion.
    Is there some way without to use COL1||PV1||COL2||COL3||COL4||PV2... etc
    thank you in advance
    using 9.2.02

    It's easy enough to write a function to do this. Here is a "coffee time" implementation:
    create or replace function multi_concat
        (p_args sys.dbms_debug_vc2coll)
        return clob
    as
        rv clob;
    begin
        dbms_lob.createtemporary(rv, TRUE);
        for i in p_args.first .. p_args.last
        loop
            dbms_lob.writeappend(rv, length(p_args(i)), p_args(i));
        end loop;
        return rv;
    end multi_concat;
    /And the proof of the coffee is in the dunking of the doughnut:
    SQL> select multi_concat ( sys.dbms_debug_vc2coll ( ('Red Fish', 'Blue Fish', 1, 'Fish',2,'Fish'))
      2* from dual
    MULTI_CONCAT(SYS.DBMS_DEBUG_VC2COLL('REDFISH','BLUEFISH',1,'FISH',2,'FISH'))
    Red FishBlue Fish1Fish2Fish
    SQL> I would add a TO_STRING member function to your type and use something like the above to implement it.
    Alternatively, use the data dictionary to generate a string which joins all your type's attributes with the concatenation operator.
    Cheers, APC

Maybe you are looking for