How to Ignore records having duplicate field value

Hi,
I have a fixed length flat file having multiple records.
Ex:
1000423421A8090
1000802421A8091
1000454421B8092
1000412421C8093
The first 2 record has A. So I have to take only one out of first two record and ignore the second one. I mean if there is any duplicate field at 11th position then I have to select only one record.
Can you please let me know how to handle this.
Thanks
Mukesh

Mukesh,
Use the following UDF to achieve the same.
<u><b><i>getchar</i></b></u>
char ret = Values.charAt(10);
return ""ret"";
<u><b><i>Maptarget</i></b></u>
   //write your code here
int len = Values.length;
String char_at="";
String pos="";
for(int j=0;j<len;j++)
if(j==0){
result.addValue(Values[j]);
else
char_at= ""+ Values[j-1].charAt(10);
pos=""+Values[j].charAt(10);
if(!char_at.equals(pos))
result.addValue(Values[j]);
<b><i><u>Mapping Logic</u></i></b>
1. Use sort by key function
in the first parameter map - Source -UDF(getchar)
in the second parameter map -Source
2.Map the output of sortbykey to UDF(Maptarget)
3.Finally Map the o/p of UDF to target.
I checked it, its working as per your reqmt.
If you have any doubts reply me I'll help you out.
Note: In UDF(MapTarget) use Queue
Best Regards,
Raj.

Similar Messages

  • How can we read the screen field values from the report selection screen wi

    Hi expart,
    How can we read the screen field values from the report selection screen with out having an ENTER button pressed  .
    Regards
    Razz

    use this code...
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.
    **Read the Values of the SCREEN FIELDs
    CALL FUNCTION 'DYNP_VALUES_READ'

  • The record has duplicate key values - "Include in Unique Index" checkbox missing

    I have a Silverlight client app that I'm developing in Lightswitch in VS2013 Ultimate Update 1, and have run into a problem when adding records.
    I am working against an external SQL Server 2008 database, and the table in question only has the primary key constraint, meaning that the ID field is an identity field, set as the primary key.
    When I try and add records to the table from the app, I get an error "The Shiur record has duplicate key values." This seems to happen when I add a row that has the same Speaker as an existing one. If I add one with a new Speaker then
    it inserts OK.
    Whilst searching for information on this error, I saw many comments around about there being a problem in earlier releases with the "Include in Unique Index" not working properly. This looked like my problem, except for two points...
    1) This table doesn't have anything in a unique index (as far as I know), as I never set it up to have any. You can see the details here...
    This looks to me like there is only the one index, which is the primary key one.
    2) The "Include in Unique Index" checkbox doesn't appear on my Properties panel at all. If I open the table in the designer, then click in the Speaker row, I don't see "Include in Unique Index" at all...
    Actually, I don't see "Include in Unique Index" at all, irrespective of what I click. It's just not there.
    So, I don't seem to have a unqiue constraint to violate, and VS doesn't show me the "Include in Unique Index" to allow me to check this, but I still get the error on insert. Anyone any ideas what's going on here?
    Thanks
    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers.
    Download from the Visual Studio Gallery.
    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at
    http://dotnetwhatnot.pixata.co.uk/

    Hi Alan,
    'Include in Unique Index' is for intrinsic database entity properties.
    Ah, that explains why I can't see it then :)
    Is LightSwitch or SQL throwing the error?
    Ah, you're a genius! Well, not quite, but your question led me to the answer.
    For some odd reason, the primary key fields on my tables seem to have lost their identity setting, so when it tried to insert a new record, the ID wasn't automatically increased, so was going in as zero. This worked fine for the first insert, as there wasn't
    a record with zero ID, but failed for the second.
    Changed the ID fields to be identity, and all works fine now :)
    Thanks very much.
    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers.
    Download from the Visual Studio Gallery.
    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at
    http://dotnetwhatnot.pixata.co.uk/

  • How to get the object class field value in CDHDR table for vendor

    hi
    how to get the object class field value in CDHDR table for vendor

    Try KRED/KRED_N as object class in CDHDR for Vendor.

  • How to fetch the Business area field value from MIRo into report

    Hi,
    I want to create a report for MIRO with payment details.
    How to fetch the business area field value in to report.
    What is the table name. I verified it is storing in structure. Which is the right table for fetching that value with reference to MIRO.
    After that, how to find the accounting document for payment and check details.
    What are the table names and field names. What we can get from PAYR table.
    With regards
    Lakki

    Dear,
    For Bussiness area
    RKPF-GSBER

  • How to get POF object's field value from query result

    hi,all:
    I want to get field value from the query result, my code is below
    Set setResults = cache.entrySet(createFilter("homeAddress.state = 'MA'"));
    for (Iterator iter = setResults.iterator(); iter.hasNext(); )
    Contact c=(Contact)iter.next();
    System.out.println ("firstame####=" + c.getFirstName());
    * but I get error*
    Exception in thread "main" java.lang.ClassCastException: com.tangosol.util.ConverterCollec
    tions$ConverterEntrySet$ConverterEntry cannot be cast to com.oracle.handson.Contact
    at com.oracle.handson.QueryExample.printResults(QueryExample.java:159)
    at com.oracle.handson.QueryExample.query(QueryExample.java:86)
    at com.oracle.handson.QueryExample.main(QueryExample.java:43)
    who can tell me how to get POF object's field value from query result

    Hi,
    If you look at the Java Doc for the entrySet method here http://download.oracle.com/docs/cd/E15357_01/coh.360/e15725/com/tangosol/util/QueryMap.html#entrySet_com_tangosol_util_Filter_ you will see that it returns a Set of Map.Entry instances so you need to do this...
    Set setResults = cache.entrySet(createFilter("homeAddress.state = 'MA'"));
    for (Iterator iter = setResults.iterator(); iter.hasNext(); )
        Map.Entry entry = iter.next();
        Contact c=(Contact)entry.getValue();
        System.out.println ("firstame####=" + c.getFirstName());
    }JK

  • How can you trim the contact field value without cloudconnector?

    How can you trim the contact field value without cloudconnector?

    You can add your contacts to segments, while right-clicking on the criteria you have added in segments, you will see the option for Merge, Intersect & Trim.
    See the attached URL, it might help you .
    Merge, Intersect, Trim

  • How to ignore blank/null key figure value in BI Queries

    Reports on Multiprovider - we see some cells of a Key figure as blanks. These blanks are interpreted as zeros by the system and calculated accordingly resulting in incorrect values. As per our requirement, we need a count of all hard/real zeros only, not the blanks. For example, if there are 10 rows of which 6 are real zeros and 4 are blanks - our count should be 6 and not 10.
    How to ignore the blanks in BEx queries please?
    Thanks for your help.
    Upender

    Rakesh,
    It is not possible to find a pattern because the report is on a MultiProvider with 2 InfoProviders- Purchasing documents DSO and Material Movements InfoCube.
    Every Purchasing Document has several materials associated with it. These materials are compared with materials in Materials Movement. Not all materials in Purchasing Document are found in Materials Movement. For those Materials found in Materials Movement, the Quantity is obtained. For these found rows, the correct value is showing up - if the quantity is zero, it is showing in reports as zero. If the material is not found in Material Movements then Quantity shows up as blank values.
    My requirement is ignore such blank quantities and not count them. Only Quantities with 0 values should be counted. Currently both blanks and zero values are counted showing inflated count.
    Thanks,
    Upender

  • How to avoid the truncation of  field values in select-options

    Hi all,
    I have a requirement where i have used select-options to select multiple filenames.  I have taken the filename of type rlgrap-filename(128 char) But the problem is in select-options if the values of the filename which is selected has length ( i.e the length of the selected field value) exceeds 45 character , then he remaining charactes are truncated. Hence i am not able to get the
    correct field value in the internal table of the select-options.
    i came to know that if NO_DISPLAY addition is used then this truncation wont occur. But in my case user has to select the files and hence this addition cannot be used.
    please let me know if anyone has a solution for this or if there is any other way to select multiple entries in selection screen.
    Regards
    Manipal parkala

    rlgrap-filename is having the length of only 128 characters.If the file path exceeds 128 characters then the rest will get truncated.If you file name exceeds more than 128 characters and the pafth is fixed,then harcode the entire path in the program and later on concatenate the path and the file name into a string which can be used for further processing.
    paramters:p_file like rlgrap-filename.
    here just give the filename as say 1234.XLS.(Assuming that you are not browsing for the file using F4_filename).
    In the program harcode the path say C:\Documents and setting\sapworkdir\user\.
    Now concaternate these two and pass it to string which can be used for further processing.
    If the user intneds to browse the file and the path name exceeds 128 characters then follow the way to delcare the paramter in the selection screen as said above.If it is working for parameters then I think it should be working for select option also.

  • How to grap the disable text field values

    Dear All,
    i have a lov,
    in this lov,i create 3 mappings for display those return values in text iput fieldss
    i want to grab those text fields valuess
    and assign those those values to another vo(table)
    those grapping fields are not changed thats y i kept in disable mode
    that time whenever any action is occure then disable field values are gone
    that time i pass only null to vo.
    but i want to grap the value when i kept those fields are in disalbe alsooo
    how can i grap those valuess.

    you have to create item of type form value & create lOV mapping so that the value will not get lost
    Thanks
    --Anil                                                                                                                                                                                                                                           

  • How to find roles with open field values

    Hello SAP gurus,
    I need to find a way to find roles with open field values. Some kind of report that returns me a list of all roles that, despite having a generated profile, it still contains empty field values in it.
    Is there anything like it available on SAP?
    Thanks
    Antonio

    Some kind of report that returns me a list of all roles that, despite having a generated profile, it still contains empty field values in it
    Hey I am not sure, but seems I might have seen some report like that. Can you try search report named PFCG* / PFUD*
    Again this is either report (SE38/SA38) or may be FM (SE37). I am away from system a bit while and can't recall.
    Regards,
    Arpan Paik

  • How can we make one view field value to be copied to other field of the the

    Hi   
       I am new  in CRM2007 I have enhanced sap component & enhanced SAP View but I wanted the field value of the enhanced view to be mapped to the field value of the same view which is added from EEWB
    Pls tell me if the added new field can be made as Dropdown list box without fixed values & Design Layer customizing I mean to say through coding can we made the input field as Dropdown
    Appreciate any help in advance
    Thanks
    Neel

    Hi,
    You can write your own ligic in GET_V_<FIELD> method. Select the values which needs to be displayed in the drop down list based on your own condition. Some sample code is given below:
    METHOD get_v_zzverksomr.
      DATA: lt_ddlb           TYPE bsp_wd_dropdown_table,
              ls_ddlb           TYPE bsp_wd_dropdown_line,
              lv_display_only   TYPE string,
              gr_ddlb_verksomr  type ref to CL_CRM_UIU_DDLB,
              ls_verksomr_values  TYPE LINE OF vrm_values.
        SELECT verksomr verksomrtxt FROM zkb_verks
           INTO TABLE lt_ddlb.
        IF sy-subrc EQ 0.
          INSERT INITIAL LINE INTO lt_ddlb INDEX 1.
        ENDIF.
      IF gr_ddlb_verksomr IS NOT BOUND.
        FREE gr_ddlb_verksomr.
        CREATE OBJECT gr_ddlb_verksomr
          EXPORTING
            iv_source_type = 'T'.
        LOOP AT gt_verksomr_values INTO ls_verksomr_values.
          ls_ddlb-key   = ls_verksomr_values-key.
          ls_ddlb-value = ls_verksomr_values-text.
          APPEND ls_ddlb TO lt_ddlb.
        ENDLOOP.
        gr_ddlb_verksomr->set_selection_table( it_selection_table = lt_ddlb ).
      ENDIF.
      rv_valuehelp_descriptor = gr_ddlb_verksomr.
    ENDMETHOD.
    Thanks
    Swagatika

  • How to pass custom z table field values to smartform

    hi i need to pass fields values from the table i created to already developed smartform..can anyone give me an example for this scenario

    Hi,
    You need to create an internal table in print program. Then fill the internal table using select statement. Now you need to declare One internal table in 'TABLES' tab of Form Interface in smartfrom.
    e.g.:
    IT_BKPF     LIKE     ZBKPF
    Now call the smartform in print program & pass the internal table(declared & filled in print prog) to the smartform.
    Ashven

  • How to select records filter by the value which stored in xml field

    I read many datas to solve my problem,but those doesn't work...
    At first, I create a table in sqlserver
    CREATE TABLE [dbo].[Demo](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Content] [xml] NOT NULL
    Then I insert two records:
    INSERT INTO Demo(Content) VALUES(
    '<plan>
    <teachers>
    <teacher>1</teacher>
    <teacher>2</teacher>
    </teachers>
    </plan>')
    INSERT INTO Demo(Content) VALUES(
    '<plan>
    <teachers>
    <teacher>3</teacher>
    <teacher>4</teacher>
    </teachers>
    </plan>')
    Now ,I want to get the records which the Content field's teacher=3. I try my best to sovle it ,but I can't.
    Are there somebody can help me? Thanks !

    You can use the .exist method to do that.  Try these:
    SELECT *
    FROM Demo
    WHERE Content.exist('plan/teachers/teacher[. = 3]') = 1
    DECLARE @teacherId INT = 3
    SELECT *
    FROM Demo
    WHERE Content.exist('plan/teachers/teacher[. = sql:variable("@teacherId")]') = 1

  • How to modify person or group field value with new value

    Hi
    I have person or group field having property Person Only.
    Thsi firls already have one value. Now I want to update it but this code to update value is not working.
    string myName = @"ABC\myname";
    web.EnsureUser(myName);
    SPUser myUser = web.SiteUsers[myName];
    SPFieldUserValue myNamevlaue = new SPFieldUserValue(web, myUser.ID, myUser.LoginName);
    oSplistItem["My_x0020_User"] = myNamevalue;
    oSplistItem.Update();
    I am getting myNamevalue correct in the veriable. But why its not updating in the list?
    is there any issue in the above code?
    Do I need to delete previous value and then update new value in this field? How?

    Hi,
    The format of the user value in people/Group field must be
    ID;#Name, you can use the following code snippets to update the people/group field.
    string loginName = "ABC\\myname";
    SPUser user = web.SiteUsers[loginName];
    SPList list = web.Lists.TryGetList("ListName");
    if (list == null)
    Console.WriteLine("list is not exist!");
    return;
    SPListItem item = list.GetItemById(3);
    item["My_x0020_User"] = user.ID.ToString() + ";#" + user.Name;
    item.Update();
    Thanks,
    Jason
    Please remember to mark the reply as answer if it help, and unmark the answer if it provide no help.

Maybe you are looking for

  • A fix for the iTunes -- iPhone indefinite sync bug

    Moderators feel free to move this to the appropriate place. I was having this problem for a while now. I'd connect my iphone and it would sync forever. I'd have to manually abort the sync. This led to stuff never actually syncing, and music disappear

  • Content conversion File Query.

    Hii, I wanted a little help with the content conversion. I have mentioned the parameters bleow: Document Name: MT_Vault_TRY RecordStructure: DT_DLY_DEPOSIT1.* Key Field Name: DT_DLY_DEPOSIT1.STRNBR parameters: DT_DLY_DEPOSIT1.fieldNames STRNBR,SLSDT,

  • Thunderbolt target display - mini to MBP

    I have a mac mini and want to use the target disply function on my MBP. both devices connect via Thunderbolt, pressing CMD F2 on the MBP unfortunatley doesnt give me a screen. Is there something I am missing? best -H

  • Port forwarding in Solaris 8

    Hi, I am new to Solaris and am trying to set up a simple port forwarding from port 80 to 8080. I know how to do this in Linux: iptables -t nat -I PREROUTING -p tcp dport 80 -j REDIRECT to-port 8080 but cannot find a way to do this in Solaris. I have

  • Still cannot get code to display correctly when clicking on a link...

    With jdeveloper 10.1.3.2 I used to be able to do right click/find usages/ and click on one of the usages and the cursor would be placed on the proper java class and line but now, when I click on the usage, it places me on the proper java class but th