Author |
Message
|
LH33 |
Posted: Thu Feb 05, 2004 8:30 am Post subject: CARDINALITY ISSUE |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
I have a message flow that checks for values and then throws a user exception if the values are invalid. I am not getting my expected results. Can someone help me understand what I am doing wrong?
Thanks!! Lisa
Here is my code: The input value for FIL1 = XX the input value for FIL2 =MM
CODE:
IF ( FIL1 <> 'TR' ) THEN
SET OutputLocalEnvironment.Errors.FIL1 =
('Invalid Data sent from System.');
IF (FIL2 <> 'MM') THEN
SET OutputLocalEnvironment.Errors.FIL2 =
('Invalid Time sent from System.');
DECLARE C CHAR;
SET C = CARDINALITY(OutputLocalEnvironment.Errors.*[]);
IF C > 0 THEN
DECLARE ALLERRORS CHAR;
SET ALLERRORS = (OutputLocalEnvironment.Errors.FIL1 || ' ' ||
OutputLocalEnvironment.Errors.FIL2);
Throw user exception values (ALLERRORS);
END IF; |
|
Back to top |
|
 |
EddieA |
Posted: Thu Feb 05, 2004 9:28 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Haven't got time to actually run this, but I know it will fail if one of the error conditions DON'T happen. Concatenating strings that don't exist can lead to the result being set to NULL.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
LH33 |
Posted: Thu Feb 05, 2004 9:30 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Thanks! In this case, the first error condition exists and it's still not working. Any ideas?
Lisa |
|
Back to top |
|
 |
CoolDude |
Posted: Thu Feb 05, 2004 10:34 am Post subject: |
|
|
Apprentice
Joined: 17 Jan 2004 Posts: 39
|
As Eddie has specified
Quote: |
Concatenating strings that don't exist can lead to the result being set to NULL.
|
Try this:
SET OutputLocalEnvironment.Errors.FIL1 = ' ';
SET OutputLocalEnvironment.Errors.FIL2 = ' '; -- just to avoid null if not allocated any value in the code. Its basically initializing the variables.
and then your code.
Quote: |
CODE:
IF ( FIL1 <> 'TR' ) THEN
SET OutputLocalEnvironment.Errors.FIL1 =
('Invalid Data sent from System.');
IF (FIL2 <> 'MM') THEN
SET OutputLocalEnvironment.Errors.FIL2 =
('Invalid Time sent from System.');
DECLARE C CHAR;
SET C = CARDINALITY(OutputLocalEnvironment.Errors.*[]);
IF C > 0 THEN
DECLARE ALLERRORS CHAR;
SET ALLERRORS = (OutputLocalEnvironment.Errors.FIL1 || ' ' ||
OutputLocalEnvironment.Errors.FIL2);
Throw user exception values (ALLERRORS);
END IF;
|
Also looking at your code what i understood is :
If -> IF - End if;
i think this should be
If ->IF -> end if -> end if;
thanks,
 _________________ Correct Me from Wrong . If i am correct Appreciate Me  |
|
Back to top |
|
 |
LH33 |
Posted: Thu Feb 05, 2004 1:50 pm Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
I am using this processing in a Route To Message flow. In order to use the OutputLocalEnvironment, I need to check the LocalEnvironment and Message check box on the Advanced tab of the Compute node. When I do this I get an error saying that the Route to is unable to locate the Label node.
Is there anything else I can use to pass variables from one node to the next?
Thanks, Lisa |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Feb 05, 2004 5:29 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
LH33 wrote: |
I am using this processing in a Route To Message flow. In order to use the OutputLocalEnvironment, I need to check the LocalEnvironment and Message check box on the Advanced tab of the Compute node. When I do this I get an error saying that the Route to is unable to locate the Label node. |
Since you have to put the Label to route to into the OutputLocalEnvironment anyway, I suspect the problem is that you're doing something wrong, or not setting the destination in your error handling.
LH33 wrote: |
Is there anything else I can use to pass variables from one node to the next? |
There's always Environment instead of OutputLocalEnvironment. It's usually better to put your stuff into Environment.Variables, or Environment.<MsgFlowName>.Variables or some subtree that other people won't (or shouldn't!) touch, just so you're safe working with subflows and etc. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
LH33 |
Posted: Fri Feb 06, 2004 4:54 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Jeff,
Thanks!!! Environment.variables worked great!!
Lisa |
|
Back to top |
|
 |
|