Page 1 of 1

Display value of a parameter in an ${ask} message

Posted: Mon Aug 12, 2019 7:01 pm
by dcramer
In a transform scenario, I have a user requesting a dialog box to confirm cleaning the output directory. Ideally, I'd like to show them the path to the directory I'm asking them about removing. I was hoping I could do:

Code: Select all

${ask('Really remove ${OutputDirectory}?', radio, ('true':'Yes';'false':'No'), 'true')}
Where OutputDirectory is another parameter they've already set. But it's not rendered in the dialog. Is there a way to accomplish this?

Regards,
David

Re: Display value of a parameter in an ${ask} message

Posted: Tue Aug 13, 2019 5:02 pm
by sorin_carbunaru
Hello David,

How is "${OutputDirectory}" set? Is its value the result of another ${ask}? Or just a simple string value?

Best wishes,
Sorin Carbunaru
oXygen XML

Re: Display value of a parameter in an ${ask} message

Posted: Tue Aug 13, 2019 6:14 pm
by dcramer
In this case, it's another parameter, but not an ${ask}. I suppose someone could set that one to an ${ask} though in their version of the transform scenario. It would typically be set to ${pd}/output or something like that.

Re: Display value of a parameter in an ${ask} message

Posted: Wed Aug 14, 2019 3:31 pm
by sorin_carbunaru
Well, if that's the case, probably the most simple workaround (instead of using "${outputFolder}" is to add "${pd}/output" inside the message parameter of the "${ask}" variable. Would that be a viable option?

Re: Display value of a parameter in an ${ask} message

Posted: Wed Aug 14, 2019 5:59 pm
by dcramer
The only problem there would be the user might change the value of outputFolder to be something else. I'd have to pass in ${pd} and then hard code the output folder in the Ant to prevent that.

My sense is that the whole ${ask} mechanism is only appropriate for very simple things. For anything else, you'd have to do a more elaborate addon/extension to Oxygen's UI.

Thanks,
David

Re: Display value of a parameter in an ${ask} message

Posted: Fri Aug 16, 2019 3:14 pm
by sorin_carbunaru
Well, the $ask mechanism is actually quite powerful, as I've seen it used in very interesting ways. Unfortunately in this use-case it is not capable of expanding the name of a transformation scenario parameter to the parameter's value. I added EXM-43954 for this, and we will update this thread when the improvement will be available.

Have a relaxing weekend!

Re: Display value of a parameter in an ${ask} message

Posted: Sat Aug 17, 2019 12:58 am
by dcramer
Cool, thanks! The other things I can think of related to $ask (and may have already talked about in other threads) are:
  1. Enhance the file chooser to allow for the selection of directories instead of only files
  2. Control whether the resulting value of the file chooser starts with 'file:' or not
  3. Combine all $asks into a single dialog
  4. Control the order of $asks
That first one is really annoying if you have an outputDirectory parameter and want them to be able to choose it. Regarding the second, I can't recall which it does now, but I've been in situations where what it does wasn't what the consuming code wanted.

Regarding the expansion of params in $ask message values, I'm only imagining that being used when the other parameter is set statically in the transformation scenario. I feel like having $asks create a dynamic modal where one part depends on what was selected in another field really would be beyond what we should expect from a mechanism like this.

Regards,
David

Re: Display value of a parameter in an ${ask} message

Posted: Mon Aug 19, 2019 10:15 am
by sorin_carbunaru
Hi David,

I added all of your feedback to corresponding issues. We'll update this thread when we have any updates.

Best wishes,
Sorin C.

Re: Display value of a parameter in an ${ask} message

Posted: Mon Aug 19, 2019 10:16 am
by Radu
Hi David,

Maybe an alternative would be to create an ANT build file which runs the XSLT transformation because from ANT build files you can call Java Swing code using Javascript:

post47208.html

Regards,
Radu