Changing default file name in task.DisplaySetupDialog

6 posts / 0 new
Last post
ratanac
Offline
Joined: 02/25/2021 - 10:20
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's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

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
Offline
Joined: 02/25/2021 - 10:20

Thanks for your quick answer and the welcome. This was my first question, but I've been reading this site since 2013.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Wow, glad you have stuck around.  I hope this won't be your last question or comment.

ratanac
Offline
Joined: 02/25/2021 - 10:20

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's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

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.