Forum Discussion
FICO
17 years agoCommunity Manager
valueholder validations in RMA
valueholder validations in RMA
We have ruleset template which has a rule template. The rule template contains a string value holder called "Rule Name" which is exposed in the RMA. The requirements are:
1. Restrict the size of the input string to say 10 characters. In the display format section, I tried to set the field size but it had no effect either on the textbox size or the size of the input string. How can we restrict the size or range of an input to a value holder with in RMA. 2. The "Rule Name" supplied by the users has to be unique. I tried duplicating the name and noted that at compile time, advisor does give a warning about duplicate rule names, but I want the warning/prompt with in RMA. Any ways to achieve this? Thanks,Ram.
15 Replies
- FICOCommunity Manager
Hey Guys My Name is Vis,
I am new to blaze. I saw your conversations on ValueHolder validation, it was interesting I thought I could post my problem. Here is the problem I am encountering.
1. I wrote a custom provider to accept a String data with comma delimited, my requirement is validate all the sub strings and display to the user which sub strings are not valid, right now validation is working fine, but I am loosing my original string data what I keyed in from the Text box. Here is the example
RMA:
HCPC codes: E1234, A1111, A2222, A3333
After validation my RMA Should look like
HCPC codes: E1234, A1111, A2222, A3333. and invalid values are A1111, is a pop up window
Existing bevaiour in RMA is, my text box is getting empty.
HCPC codes: "". invalid values are A1111
Please help me in resolving this issue. I appreciate for your ideas and time.
Thanks
-Vis
Message Edited by Discuss on 02-27-2009 02:00 PM - FICOCommunity Manager
To be able to tell you where the problem is, we probably need to see the provider code.
In general, if you signal a validation error, the value will not be saved in the instantiation model. It might depend on where you signal the error, though. If you do this in the convertFromDisplayValue(..) method, the value will not be saved. If you check the value in the validateInstantiationValue(..) method, you might get lucky.
Regards,
Jostein
- FICOCommunity Manager
Hey Jostein (http://dmtforum.fairisaac.com/t5/user/viewprofilepage/user-id/89),
I appreciate for your reply and I have a great confidence on this Forum now. As you requested here is my provider code. Let me know if you need any more information. Thanks buddy stay in touch. public class DataValidatorStringProvider extends NdDefaultTemplateValueProviderimplements NdDesignProvider { private String dataType; //private String dataType = "HCPC"; static NdProviderContext context; public DataValidatorStringProvider() { super(); } public NdDesignProviderArg[] getArgumentDescriptors(NdProviderContext arg0) throws NdTemplateException { NdDesignProviderSelectableArg dataType = new NdDesignProviderSelectableArg( "dataType"); dataType.setDisplayName("Type of Data"); dataType.setMandatory(false); dataType.setChoices(new String[] { "HCPC", "ICD9","Payer"}); return new NdDesignProviderArg[] { dataType }; } public void setArgs(NdProviderContext context, NdProviderStaticArg[] args) throws NdTemplateException { super.setArgs(context, args); //_trace("Set Args length:"+args.length); //_trace("Set Args:"+args[0].getValue()); if (args != null & args.length > 0) { for (int index = 0; index < args.length; index++) { if (args[index].getName().equals("dataType") && args[index].getValue() != null) { _trace("Set args DataType:"+args[index].getValue()); this.dataType = args[index].getValue(); // System.out.println("question type " + _questionType); } } } } public void checkInstantiationValue(NdProviderContext context, String instantiationValue) { _trace("Context:"+context); _trace("instantiationValue:"+instantiationValue); } public String getDescription(NdProviderContext arg0) throws NdTemplateException { return "Data Validation"; } public String getDisplayKey(NdProviderContext arg0) throws NdTemplateException { return "String Provider"; } public String getDisplayName(NdProviderContext arg0) throws NdTemplateException { return "Data Validation"; } public boolean validateInstantiationValue(NdProviderContext context, String value) throws NdTemplateException { _trace("In validateInstantiationValue "); //boolean retValue = true; String nonValidData = ""; if( value == null && value.trim().equals("")) { _trace("Data is empty"); throw new NdTemplateException("Input Data is empty"); //throw an exception }else { //Call a java proxy service which internally calls the web service and pass the Data and DataType _trace("Data is not empty"); _trace("dataType:"+dataType); DataValidatorProxyService dvps = new DataValidatorProxyService(); nonValidData = dvps.validateData(value, dataType); _trace("nonValidData:"+nonValidData); if(nonValidData !=null && !nonValidData.trim().equals("")){ throw new NdTemplateException("This data doesnt exist:"+ nonValidData); } } return true; } private void _trace(String s) { System.out.println(s); } public static void main(String args[]){ DataValidatorStringProvider dvsp = new DataValidatorStringProvider(); try { dvsp.validateInstantiationValue(context, "E1234,E5678"); }catch (Exception e) { e.printStackTrace(); } } } - FICOCommunity Manager
Just one small thing; When you override setArgs(..) you should also override reset(..) to reset the state of your provider instance (it is being reused for all value holder instances of that type).
For your other problem:
When you throw an NdTemplateException or return false from validateInstantiationValue(..), you tell the RMA that the value is not valid, and that it should not be stored. As all your values are in the same value holder, that means that all the values are discarded by the RMA.
You need to find a way to work around this problem. A couple of options:
- Use one value holder to store the input values, for example a plain string provider. Send the values from that value holder to another value holder that implements your validation logic. You can do this by adding an argument to your existing provider implementation, for example "Data value". To send the value from the plain string provider, use a dynamic override. That way the plain string provider should hold all your values, but you should still get a validation error from the other value holder.
- Use several value holders that hold one value each. That way you will only loose invalid values, whereas valid values will be retained by the RMA.
Note that I have not tested option number 1, but I believe it should work. This option would probably be the best from a performance perspective, as you are using a web service for the internal validation.
HTH,
Jostein
- FICOCommunity Manager
Hi Jostien,
Thanks for your suggestion, I did as you suggested I am happy with the result, waiting to see the business response. Totally credit goes to you. Thanks I have many Blaze problems like these I know you are one of the potential blaze guy to take some recommendations.
Thanks
-Vis
Related Content
Related Content
How to make cuts added in a preIntsol callback globally valid (root node) instead of local to the current subtree?
I'm using the Xpress Optimizer Java API (com.dashoptimization, Xpress 9.4) to solve a MIP with lazy constraints that are generated dynamically. My constraints are all globally valid — they are not lo...2 months agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum2 unread comments2 unread31Views0likes2Comments