Forum Discussion
FICO
17 years agoCommunity Manager
Reg: Display of variable added in one Instance across other instances
Reg: Display of variable added in one Instance across other instances Hi, I have created two group templates and accordingly two instances each.. In the instance of Group template A i created one ...
FICO
17 years agoCommunity Manager
You can see the "Canadian states" provider example, which comes with Blaze Advisor for a general provider example. In that example you will see how to create argument descriptors so that you provider will have arguments, and also how to process arguments.
Just remember to extend the NdPromSrlEntitiesProvider instead of NdDefaultTemplateValueProvider or NdDefaultConstrainedListProvider.
Also note that when you override the NdPromSrlEntitiesProvider, make sure that you only extend the existing functionality, i.e. do not overwrite existing arguments. That means that when you override the getArgumentDescriptors-method, do something like this (code written from memory, so might not compile, and class/method names might be slightly wrong):
NdDesignProviderArg[] superArgs = super.getArgumentDescriptors(); // or base.get... if on .Net
NdDesignProviderArg[] myArgs = new NdDesignProviderArg[superArgs.length + 1]; // Add number of own args
System.arrayCopy(superArgs, 0, myArgs, 0, superArgs.length); // or .Net equivalent Array.Copy(...)
myArgs[lastIndex] = new NdDesignProviderSingleArg("Regular expression filter" );
myArgs[lastIndex].setMandatory(true);
return myArgs;
Likewise, in the setArgs, make sure you send the base arguments to the super class, and handle only your own arguments (easily done if you just select arguments to handle based on known names).
Then, you can override getAllowedInstantiationValues, for example like this:
public string[] getAllowedInstantiationValues(NdProviderContext context)
{
string[] values = super/base.getAllowedInstantiationValues(context); // Original provider content
if (regexFilterValue != null)
{
// regexFilterValue would be the variable that holds the filter expression taken as an argument
Regex regex = ... // initialize regular expression instance
List<string> newValues = new List<string>();
for (string value in values)
{
if (regex.isMatch(value)) newValues.add(value);
}
return newValues.toArray();
}
return values;
}
I apologize for the mixture of .Net and Java -- work in both languages now, and the "last one written" has a tendency to sneak into code examples...
Anyway - those are the basic steps. Other than that it is only your imagination that stops you
Regards,
Jostein