Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

Posted

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.

Posted

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.

Posted

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.

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 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.