Creating a Boolean DataProvider on the fly

Hi,

Indeed, when using the SolutionModel that controller.recreateUI does what the name implies. It only recreates the UI.
For resetting the whole form instance you should revert the form (or remove and create new) but that requires that the form instance is not visible or else you can’t destroy it.

Hope this helps.

ROCLASI:
Hi,

Indeed, when using the SolutionModel that controller.recreateUI does what the name implies. It only recreates the UI.
For resetting the whole form instance you should revert the form (or remove and create new) but that requires that the form instance is not visible or else you can’t destroy it.

Hope this helps.

What do you think the best solution would be?
On the previous form, should I change the button event that currently shows that form im working on, to build out what its onload is currently doing, and then show form?

Or maybe leave it in onload but make a copy of the currentForm and immediately switch to that one?

I went ahead and switched the function to run before the form is shown, rather than the onload of the form.
But I have seem to run into an extension of this problem.

Since I am creating these JSVariables on the fly, I need to be able to pull them back on the fly.
I can create a variable to pull in the JSVariable, but all it returns is the name of the JSVariable.

For example, in the function that creates the next form, it creates a JSVariable called administratorsDP(as you can see from my previous code post). Well, now to pull back that variable, I have to do something like:

var currentGroup = theGroups.getValue(i,2);
				var groupLowered = currentGroup.toLowerCase();
				var dataproviderName = groupLowered + 'DP';
				var currentDP = thisForm.getVariable(dataproviderName);

If I trace currentDP, all it stores is the JSVariables name, which is administratorsDP.
I need to return the value, so I can see if the box is checked or not.
Looking through the documentation, there is no “value” property of a JSVariable object. There is a “defaultValue”, but that does not represent the current value.
How do you obtain the currentValue of a dynamically pulled JSVariable?

As far as I remember MEDIA is for Boolean.
Look at calculations you create on tables: if you want a calculation to return true or false you set its type to MEDIA, so it’s the same thing with variables.
Set the default value to null, then assign true or false to it, should be no problem.

Cheers,
Maria

Normally, when you create a form through the solutionModel and add (form) variables, you can read their value by simply referencing them like this:

forms['myForm']._myFormVar

Hi,

volcodc:
How do you obtain the currentValue of a dynamically pulled JSVariable?

The SolutionModel works on the blueprint of a form, not on the instance that was created from that blueprint. And a blue print doesn’t contain data other than the default values from your form variables.
So like Omar already suggested you simply get the value the way you would normally read form variables.

In your case this would be:

var currentGroup = theGroups.getValue(i,2);
var groupLowered = currentGroup.toLowerCase();
var dataproviderName = groupLowered + 'DP';
var currentDP = forms[thisForm.name][dataproviderName];

Hope this helps.

ROCLASI:
Hi,

volcodc:
How do you obtain the currentValue of a dynamically pulled JSVariable?

The SolutionModel works on the blueprint of a form, not on the instance that was created from that blueprint. And a blue print doesn’t contain data other than the default values from your form variables.
So like Omar already suggested you simply get the value the way you would normally read form variables.

In your case this would be:

var currentGroup = theGroups.getValue(i,2);

var groupLowered = currentGroup.toLowerCase();
var dataproviderName = groupLowered + ‘DP’;
var currentDP = forms[thisForm.name][dataproviderName];




Hope this helps.

Ahhh, this solves everything. Thank you so much!