Find double rows in excell, combine them and import excel

0
I made a possibility to import an excel file. This alle works fine, except..... The excel sheet has a colum UniekContractnummer.  As you can see, sometimes the UniekContractnummer is the same on two (or more) rows. If so, then the 2 (or more) rows should be combined into 1 object. Is it possible to do so with a expression or something else in a microflow?  I used the Find List Operation, but that doesn't solve the problem. Anyone ideas?   Original subflow ContractList_toCommit is target entity ContractNPList is non persistant entity The FindKlant: used to find if the UniekContractNumber allready excist in target entity The FindContract: used to find the double Contracts (as I learned now, this should be a Filter operation) Create Object? is to decide whether the Contract should be created $Contract = empty and $FindContract = empty Create Contract is to create the contract with all of its attributes Change FindKlant is to set the contract to the user Add to list is to add the created contract to the ContractList_toCommit   Microflow after I changed it   Change activity   Edit 7 feb 2024 The merging works, only it duplicates. The second row shouldn't be there.   Microflow to merge two rows    
asked
2 answers
0

First a question:

Is this double row also a double row in the Excel itself?

 

My solution

  1. I always import my excel data in a temporary entity, before I store it on my target entity
  2. Create a separated module for your Excel import
  3. Add an entity which mimics your target entity (CTRL-C CTRL-V works ;-) )
  4. Use this entity for your import
  5. Create a microflow which handles the transfer from your import entity to your target entity
  6. This microflow can handle the merge of the duplicate rows
    1. Retrieve the list of the import entity
    2. Create a empty list of the target entity
    3. Loop through the list to create the target object & map the values
    4. Add the new object to the target entity list
    5. Before you create the new target object, add the list operation/find 
    6. if found don't create or merge them with a change object
    7. if not found create

Hope this helps 

answered
0

Rather than a find, you likely want a filter action, since a find only returns one object while you said there might be more rows. The filter action should return a list of all rows with the same contract number, which you can then use to create one object out of (create one object, then iterate over the list to fill the attributes).

 

Make sure not to process the rest of the rows you've already processed again, otherwise you will get duplicate objects.

answered