Jump to content
Server Maintenance This Week. ×

Script for importing a csv file whose column order keeps on changing


This topic is 2636 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm creating a script for importing a csv file. That file will get imported every week.

I don't want to present a dialog box to user for mapping field since they might make mistake.

However, there's a problem. The file's column order keeps on changing. So, I can't use the last import order.

Is there anyway I can import records on the basis of column title? I know there's matching field name option but the problem is the column title of the csv file are like "Refunds ($)" and I can't name the filed using special characters like (, $ in filemaker.

Any solution?

Link to comment
Share on other sites

1 hour ago, nexgen said:

The file's column order keeps on changing.

I find that very unusual. But if that's the situation, I would suggest you import into an intermediate table, with 2 sets of fields: a set of text fields for the initial importing and another set of fields that your import script will populate according to the value in the first record of the imported set. Then have the same script perform a second import into the real target table, using permanent mapping of the 2nd set of fields to the fields of the target table.

Link to comment
Share on other sites

20 minutes ago, comment said:

I find that very unusual. But if that's the situation, I would suggest you import into an intermediate table, with 2 sets of fields: a set of text fields for the initial importing and another set of fields that your import script will populate according to the value in the first record of the imported set. Then have the same script perform a second import into the real target table, using permanent mapping of the 2nd set of fields to the fields of the target table.

Can you please give me an example? I think I got somewhat you said but I couldn't understand it entirely.

Below is the part which I couldn't understand entirely:

Quote

with 2 sets of fields: a set of text fields for the initial importing and another set of fields that your import script will populate according to the value in the first record of the imported set.

 

Link to comment
Share on other sites

This topic is 2636 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.