Filemaker combining records


Using Filemaker 9. I am new to filemaker.  

We have a process where we imports files from another company into filemaker and then we use this data to make records for order acknowledgement and order shipment.

We get a .csv file to import into filemaker, currently we get one .csv file with four records of the same order number.

Each records has an order number has normal credentials like name address etc... and it has Product details like sequence ID field, product field, quantity field

If I import a .csv file that has four records with the same order number and credentials but different Product details. How can I combine these 4 records into one record showing the same order number and credentials with four product details.

I have already made fields in each record showing 4 product details (Sequence ID 1, Product1, Sequence ID2, Product2....etc)

So when imports i get 4 Records


Adresses: 67 horn st....

Sequence ID: 35089
Product: Cartridge 5


Adresses: 67 horn st....

Sequence ID: 5556556
Product: Cartridge 1

Record 3

Adresses: 67 horn st....

Sequence ID: 11002
Product: Cartridge 6

Record 4
Adresses: 67 horn st....

Sequence ID: 0200
Product: Cartridge 56

What I want to do is have one record like this.

Adresses: 67 horn st....

Sequence ID1: 35089
Product1: Cartridge 5

Sequence ID2: 5556556
Product2: Cartridge 1

Sequence ID3: 11002
Product3: Cartridge 6

Sequence ID4: 0200
Product4: Cartridge 56

I already have Sequence ID field, Product field and Qty field from 1-4 in each record, I just need help in combing the records/data into one record when I import it.

Any help would be greatly appreciated.

Many Thanks

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Since you CSV file has records like (you will have quotes for string columns):

Jon,67 horn st....,35089,Cartridge 5,6

In source table, this is how the data is. Now write a function passing parameters as columns Name & Addresses. Within function pass these in WHERE condition of query and use a cursor to SELECT Sequence ID + ',' + Product + ',' + Qty and feed this whole thing to a string variable v_val. If there is problem use CHAR or TO_CHAR built in function to convert integer etc. columns to string.

Now assign v_val = v_val + ' '; in cursor loop.

When all is done i.e. all records are processed and you get complete string, outside loop, add p_Name and p_Addresses at the begin and trim on right side using TRIM/RTRIM function. Now return this overall v_val. So the function call in a query should be:

SELECT fn_concat(Name, Addresses) FROM YourTable WHERE Name = 'Jon' and Addresses = '67 horn st....';

You export based on this query and you will get a CSV file which will be imported in a single row the way you want it. Cheers.
it depends if you want to end up with only one table or 2, which would be better from my point of view, ie a classic organisation, order + order lines.
if you still want to shink everything into one record per order, you need to import records as is, then run a loop to groupe them.
the principle would be:
store the order nb in a variable, details in another one.
goto next record
compare the order nb in the var with the current order nb, if the same, concatenate the details in the var with the current details, goto previous record, delete it (thats puts you on current record again.
store order nb and details in the 2 vars again
goto next field, etc...
you should end up with one record per order and all orders concatanated.
J3D1-KN1G1-1tAuthor Commented:
Thanks for your replies,

how would I set up order + order lines? what is order lines? and how will it work.

With the loop example you mentioned how does it add all the Squence ID fields(sequence ID1, Sequence ID2....etc) and the other fields(product1, product2,qty1,qty2...etc) into one record?

Many Thanks
SolarWinds® IP Control Bundle (IPCB)

Combines SolarWinds IP Address Manager and User Device Tracker to help detect IP conflicts, quickly identify affected systems, and help your team take near instantaneous action. Help improve visibility and enhance reliability with SolarWinds IP Control Bundle.

to use 2 tables, you need to import twice, and pick up the relevant fields to each of the tables, then de-duplicate the orders tables.
orders would contain the common information and order_lines the details, linked to the orders table via the order ID.
to group al information to one, you can't do it upon import, but after, by putting all information of the 3 extra field into the 1st one.
roughly: field1 = field1 & field2 & field3 a field 4
then remove field2, 3, 4 once done

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
J3D1-KN1G1-1tAuthor Commented:
i dont get it. i need to do this too and i just don't get it. can someone please post a simplified step by step answer. its been a couple years since this last thread so i hope there is a simplier way of doing this.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FileMaker Pro

From novice to tech pro — start learning today.