Duplicate values remove in reports

dheebans
dheebans Member Posts: 36
Dear all,

I have one Doubt in Generate Report,

that is,

I have Values in array structure like a :=

Now i want to remove duplicate record, and also show that value in one time,

B[1] := 45;
B[2] := 46;
b[3] := 47;

I Hope yopur Valuable Answer.

Advanced thanks,

Regards
DheebanS
--
Thanks & Regards
DheebanS

Comments

  • Belias
    Belias Member Posts: 2,998
    the easiest way is not to use an array but temporary table based on "integer" table.
    here you can insert your values with an
    myintegertemptable.number := myintegervalue;  
    IF myintegertemptable.INSERT then;
    
    then you can show the temporary table in the report (there's an "how to" in mibuso about how to show a temptable)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • dheebans
    dheebans Member Posts: 36
    Thanks your Replay,

    I am using Text array Variable,

    If possible please send any link about, create tem table.


    Thanks & Regards
    Dheeban.S
    --
    Thanks & Regards
    DheebanS
  • Egnaz
    Egnaz Member Posts: 111
    Just a quick brainstorm on your problem:
    for i := 1 to ARRAYLEN(a) do begin
      found := false;
      for j := 1 to ARRAYLEN(b) do begin
        if a[i] = b[j] then
          found := TRUE;
      end;
      
      if found then begin
        b[i] := 0;
      end else begin
        b[i] := a[i];
      end;
    end;
    

    Maybe an approach for you.
  • Belias
    Belias Member Posts: 2,998
    @egnaz's: that approach will create empty elements in the array, i don't know if it's what he wants :-k let's see what he say

    if your elements are texts, the same approach i described is still valid: you can create a new table with one text field only and use this new table instead of the "integer" table i told you before.
    NOTE: if you use your new table ONLY as temporary, you don't even need to create that table in customer's license object range :thumbsup: you can create it as 99999, for example
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Egnaz
    Egnaz Member Posts: 111
    I'm with you. I think a temp. table is the best solution. You can also use a buffer table as temp. table for example the excel buffer.

    My approach was only for finding a solution/approach for arrays. The empty array element is a behavior I had in mind so this is only an approach and perhaps he can skip "blank" elements in the report. Nobodys knows atm what the report does with this array values.

    Best solution will be a temp. table of course.

    Regards,
    egnaz
  • dheebans
    dheebans Member Posts: 36
    Thanks your ideas,

    I am using TemTable,

    Now i found Fields already exit error.

    how can i remove this error.


    Thanks Regards
    DheebanS
    --
    Thanks & Regards
    DheebanS
  • Belias
    Belias Member Posts: 2,998
    dheebans wrote:
    Now i found Fields already exit error.

    how can i remove this error.
    :-k
    is this google translator?
    really, i don't understand what you said...if there's an error, you have to post the error message!
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • dheebans
    dheebans Member Posts: 36
    while i am inserting records in a new table

    Using table name TemInvoice,

    The TempInvoice already exit
    Identification values ''12345 '



    Herewith i attached error Doc

    Thanks & Regards
    DheebanS
    --
    Thanks & Regards
    DheebanS
  • mohana_cse06
    mohana_cse06 Member Posts: 5,506
    delete temporary table in the begining of your code
    TempTable.DELETEALL;
  • Belias
    Belias Member Posts: 2,998
    ](*,) ](*,) ](*,) ](*,) ](*,)
    i think you have to study some materials before starting to develop
    1. do you know why i've suggested you to use a temporary table in order to avoid duplicates, or are you blindly following my suggestion?
    2. do you know what is a primary key?and why you cannot have 2 records with the same primary key in the same table?
    3. no errors can arise if you have written the code as i do: "IF INSERT THEN;"
    Sorry, i've been a little rude, but it's not fair to ask questions like this in the forum: i hope you have a senior developer near you that supports you with these kind of questions.
    P.S.: DELETEALL is not specifically needed in your piece of code, i guess it won't solve the problem.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • dheebans
    dheebans Member Posts: 36
    I agree your commands,

    I Don't have Senior consultant, so only i am asking like this error,

    I am using temptable.Deleteall. Its allow to duplicate Values.

    Just i want one help,

    How to compare Array, the compare Value is found or not.



    Thanks
    DheebanS
    --
    Thanks & Regards
    DheebanS
  • dheebans
    dheebans Member Posts: 36
    Hi mirko,

    Thanks a lot your valuable hints, i hot result using Temp Table.




    Thanks & Regards
    DheebanS :thumbsup:
    --
    Thanks & Regards
    DheebanS