cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
james_decosta
Level 9

Hello i want to display a message dialog

Hello,
I have a requirement in which i need to check the database which user is using and check if database contains the required databases and i want to display this panel when i am using typical install.
So this is what i did:
I added a panel in the pre install task saying" DB configuration is done properly"
to which i added a custom rule (my own for connecting to database and checking if it contains the required databases) and i again added one more rule
by "AND" operator in the rule list.
Basically i want to display the panel only when both my customrule is true and chosen_install_set is typical .Similarily if the database does not contain the required databases , i am displaying a panel which says "Database is not configured properly" when the chosen_install_set is typical and my custom rule for database improper is true.
To my surprise even when i am inputting correct information it is showing the
DB wrong configured panel.
Can anyone tell me why?
Labels (1)
0 Kudos
(7) Replies
purcellk24
Level 7

I would say your rules are not correct. Since it sounds like the the "bad" panel is being displayed, your rule to for chosen_install_set=typical is working fine. (Unless these panels are being displayed if you are not choosing typical).

Then I would double check your custom rule to make sure it returns true when you want it to.

Otherwise, I suggest posting your project so it is easier for others to help.
0 Kudos
james_decosta
Level 9

hi ,
i have added the rules for proper connection as ROCustomRuleTrue and for any discrepancy in connection as CustomRuleFalse.
Please notify if there are any discrepancies
0 Kudos
purcellk24
Level 7

Ok. I have a couple of suggestions.
1. Only write this rule once and set an IA variable if it is true/false instead of writing a "True" one and a "False" one. This will avoid duplication of custom code.
2. When you call ruleProxy.setVariable(), don't put the variable name inside the $$.
Bad: ruleProxy.setVariable("$SOME_VAR$", "value");
Good: ruleProxy.setVariable("SOME_VAR", "value");

3. In your CustomRuleFalse code, do this..
String emptyString = ruleProxy.substitute("$NULL$");
ruleProxy.setVariable("USER_INPUT_RESULT_0", emptyString);

4. In your CustomRuleFalse, you have some System.out.println statements with ruleProxy.substitute("$USER_INPUT_RESULT_1"). Make sure you have $ on BOTH sides of the variable name. $USER_INPUT_RESULT_1$
5. Use the debug output to your console. You should see your System.out.println() statements being output. This will help debugging and finding out your problems.
6. Use pV7721's suggestion of using better named variables instead of USER_INPUT_RESULT_x. It will be much, much easier to maintain your code.
7. Also, post your project (iap_xml) file (zipped from what I've read here). If you are not allowed to post your project, post a sample project that only does what you are posting about. You may find that when creating that sample project, you will find your mistakes.
0 Kudos
Yves_Kreis
Level 7

purcellk24 wrote:
2. When you call ruleProxy.setVariable(), don't put the variable name inside the $$.
Bad: ruleProxy.setVariable("$SOME_VAR$", "value");
Good: ruleProxy.setVariable("SOME_VAR", "value");



The bad code is working isn't it?

Best Regards,
Yves
0 Kudos
purcellk24
Level 7

Well, I have never had good luck with setVariable("$VAR_NAME$", value); so I make it a practice to make sure there are no $$ in the set Variable. Even in the ide. If it does work, then ignore what I said.

Some of the actual bad code in the example posted here have setVariable("$VAR_NAME", value) and is missing the second $. That is bad.
0 Kudos
Yves_Kreis
Level 7

Yes they work. I normally use a Constants interface where I set static final variables and explain their usage and as I use them for retrieval and setting i need to have the $$.

Best Regards,
Yves
0 Kudos
james_decosta
Level 9

hello,
as it has been said to me instead of duplicating the custom rule action once for true result and once again for the false result,i got to know that i can set some installanywhere variable accordindly for true result and for false result in the same install anywhere action.
But as far as i know an action with a custom rule will evaluate only if the evaluate() method returns true.
So in the try block what shall i set and catch block what shall i set,it would be a pleasure if you can give some suggestions.
James Decosta
0 Kudos