SteveB Posted November 13, 2003 Posted November 13, 2003 Has anyone figured out how to simulate the Define Import Dialog, since it isn't a Scriptmaker option. What I'd like to do is give a user the ability to import CSV or tab-separated values by mapping fields in the input file with the fields in an FM file. Steve
BobWeaver Posted November 13, 2003 Posted November 13, 2003 You can create a set of import fields that the user never sees, and always import into those. Then, let the user select a mapping that transfers the data from these import fields into the regular fields. For example you might have 20 import fields named ImportField1, ImportField2, ... ImportField20. Your script would always import into these fields. So a script might be: Import [restore] SetField[MyRegularField1, GetField("ImportField"&gF1Order)] SetField[MyRegularField2, GetField("ImportField"&gF2Order)] SetField[MyRegularField3, GetField("ImportField"&gF3Order)] ... SetField[MyRegularField20, GetField("ImportField"&gF20Order)] The globals gF1Order, gF2Order, etc., would be the actual field mapping previously set by the user in some sort of dialog.
SteveB Posted November 14, 2003 Author Posted November 14, 2003 Okay, but what does the dialog look like. Do I use a portal and move the field order up and down in the portal? Other suggestions?
BobWeaver Posted November 14, 2003 Posted November 14, 2003 That's the tricky part. You can't drag field names up and down like in a regular import dialog, but you could implement one of those portal ordering techniques. I think Dj posted an example in the samples forum.
Ugo DI LUCA Posted November 14, 2003 Posted November 14, 2003 Yes, Dj's renumbering portal rows technique would surely help here. I've been doing something very similar a while back (while not an import procedure) just using this posted technique. You could even set a default order.
BobWeaver Posted November 21, 2003 Posted November 21, 2003 Hey Steve, have a look at this: http://www.fmforums.com/threads/showflat.php?Cat=&Number=87713&page=0&view=collapsed&sb=5&o=365&fpart=1
Recommended Posts
This topic is 7674 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 accountSign in
Already have an account? Sign in here.
Sign In Now