November 13, 200322 yr 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
November 13, 200322 yr 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.
November 14, 200322 yr Author 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?
November 14, 200322 yr 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.
November 14, 200322 yr 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.
November 21, 200322 yr 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
Create an account or sign in to comment