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

Are you missing a feature? Request it's implementation here.
dcramer
Posts: 154
Joined: Sat Aug 28, 2010 1:23 am

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

Post by dcramer » Mon Aug 12, 2019 7:01 pm

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

sorin_carbunaru
Site Admin
Posts: 245
Joined: Mon May 09, 2016 9:37 am

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

Post by sorin_carbunaru » Tue Aug 13, 2019 5:02 pm

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

dcramer
Posts: 154
Joined: Sat Aug 28, 2010 1:23 am

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

Post by dcramer » Tue Aug 13, 2019 6:14 pm

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.

sorin_carbunaru
Site Admin
Posts: 245
Joined: Mon May 09, 2016 9:37 am

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

Post by sorin_carbunaru » Wed Aug 14, 2019 3:31 pm

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?

dcramer
Posts: 154
Joined: Sat Aug 28, 2010 1:23 am

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

Post by dcramer » Wed Aug 14, 2019 5:59 pm

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

sorin_carbunaru
Site Admin
Posts: 245
Joined: Mon May 09, 2016 9:37 am

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

Post by sorin_carbunaru » Fri Aug 16, 2019 3:14 pm

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!

dcramer
Posts: 154
Joined: Sat Aug 28, 2010 1:23 am

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

Post by dcramer » Sat Aug 17, 2019 12:58 am

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

sorin_carbunaru
Site Admin
Posts: 245
Joined: Mon May 09, 2016 9:37 am

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

Post by sorin_carbunaru » Mon Aug 19, 2019 10:15 am

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.

Radu
Posts: 6453
Joined: Fri Jul 09, 2004 5:18 pm

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

Post by Radu » Mon Aug 19, 2019 10:16 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply