Skip to main content

Changing default file name in task.DisplaySetupDialog

Hi, I'm trying to change the default file name (join.imd to ABCinc.imd for example) in task.DisplaySetupDialog.
But when I excute the script, the default name displayed is still join.imd. Is there a way to change the default name?
I also want to change the default selection to: task.PerformTask dbName, "", WI_JOIN_ALL_IN_PRIM
How can I do that with task.DisplaySetupDialog?
Thanks for help.
 
Sub Main
     Set db = Client.OpenDatabase("Sample-Detailed Sales.IMD")
     Set task = db.JoinDatabase
     task.FileToJoin "Sample-Inventory.IMD"
     task.IncludeAllPFields
     task.IncludeAllSFields
     task.AddMatchKey "PROD_CODE", "PROD_CODE", "A"
     dbName = Client.UniqueFileName ("ABCinc.IMD") <-----Won't keep the new name
     task.DisplaySetupDialog 0
 
    Set task = Nothing
    Set db = Nothing
    Client.OpenDatabase (dbName)
End Sub

Brian Element Thu, 02/25/2021 - 13:27

Hello ratanac and welcome to the site.

Unfortunately what you want to do is not possible.  The task.DisplaySetupDialog takes over for the task.performTask and this is where you add the default file name and the join type.  There are no parameters that I know of to add this information.

When I have come up in these scenarios I have created my own dialogs either in IDEAScript or Python but this can be very time consuming.

ratanac Fri, 02/26/2021 - 15:02

These days, I've been testing task.DisplaySetupDialog and find out that:
- The join file won't be displayed, so can't use Set db = Client.currentdatabase
- IDEA doesn't seem to keep the name of the join file in memory
Is this normal?

Brian Element Sat, 02/27/2021 - 01:12

In reply to by ratanac

I have never used the task.DisplaySetupDialog in any of my scripts because there are so many limitations around them.  Like you noticed you don't know what the user has actually selected if you need that information in the future sections of the script.  I have always ended up creating my own dialogs as I then can control 100% of what is going on.