Author |
Message
|
bindu |
Posted: Tue May 18, 2004 4:42 am Post subject: checking Required fields ...WMQI---SOLVED |
|
|
Voyager
Joined: 07 May 2004 Posts: 97
|
Hi,
For my request i do have nearly 20 required fileds...so i am cheking those in a filter node by using 20 if loops so any suggestions aport from this way can i check those required fields with less code...Any suggestions.
Thanx,
Bindu
Last edited by bindu on Wed May 19, 2004 9:48 am; edited 1 time in total |
|
Back to top |
|
 |
psn |
Posted: Tue May 18, 2004 5:16 am Post subject: |
|
|
Disciple
Joined: 30 Oct 2002 Posts: 193 Location: France
|
Hi,
why not use a messageset with validation in input node ?
PSN |
|
Back to top |
|
 |
wooda |
Posted: Tue May 18, 2004 5:16 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
Use the MRM.
Set Min Occurs >= 1 for those fields (ie they are mandatory)
Turn on Validation in the flow.
Bingo the MRM will validate the message for you.
You can also validate lots of other things as well as required fields. |
|
Back to top |
|
 |
bindu |
Posted: Tue May 18, 2004 5:23 am Post subject: checking Required fields ...WMQI |
|
|
Voyager
Joined: 07 May 2004 Posts: 97
|
Hi ,
Thanx for quick reply but i need to throw an exception if those are not present so any suggestions.
Thanx,
bindu |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue May 18, 2004 5:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The MRM parser will throw an exception if there are missing fields that it believes are required, and you have enabled validation either on Input or on a Compute node.
At least in 2.1 CSD04 or later. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bindu |
Posted: Tue May 18, 2004 8:50 am Post subject: checking Required fields ...WMQI |
|
|
Voyager
Joined: 07 May 2004 Posts: 97
|
Hi,
Without using message set can i do this.Any suggestions.
Thanx,
Bindu |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue May 18, 2004 9:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You have to tell WMQI which fields are required - either by writing code that says "these field are required" or by creating a message description that says "these fields are required".
If you don't want to use a message set, that means you have to use ESQL.
Whether or not you can use "less" ESQL depends on - what your current ESQL looks like
- what your data looks like
- What version of WMQI you are using
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bindu |
Posted: Tue May 18, 2004 10:28 am Post subject: checking Required fields ...WMQI |
|
|
Voyager
Joined: 07 May 2004 Posts: 97
|
Hi jef,
Right now i am using MQSI2.1,
only XML elements...so is there any easy way to check the required fields by using ESQL.Any suggestions.
Thanx,
Bindu |
|
Back to top |
|
 |
Missam |
Posted: Tue May 18, 2004 11:07 am Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
There is a function called CARDINALITY.you can make use of it.
See ESQL Reference |
|
Back to top |
|
 |
bindu |
Posted: Tue May 18, 2004 11:09 am Post subject: checking Required fields ...WMQI |
|
|
Voyager
Joined: 07 May 2004 Posts: 97
|
Hi Misssam,
i want to check the required fields in ESQL and send back error message if any one of missing.Any suggestion.
Thanx,
Bindu |
|
Back to top |
|
 |
Missam |
Posted: Tue May 18, 2004 11:22 am Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
Run CARDINALITY against the filed you want to check.it'll return the no of occurences of the field
Lets say you have a field like InputRoot.XML.Message.Field1
CARDINALTY(InputRoot.XML.Message.Field1[]) Gives you no of occurences Field1.if you don't have Field1,it 'll return zero.
so use it like this
IF CARDINALTY(InputRoot.XML.Message.Field1[]) = 0 THEN
THROW USER EXCEPTION.......
END IF;
If you have 20 fileds like this
you can combine them in one statement like this
IF (CARDINALTY(InputRoot.XML.Message.Field1[]) = 0) OR (CARDINALTY(InputRoot.XML.Message.Field2[]) = 0) OR (CARDINALTY(InputRoot.XML.Message.Field3[]) = 0) OR ........................ THEN
THROW USER EXCEPTION....
END IF; |
|
Back to top |
|
 |
bindu |
Posted: Tue May 18, 2004 11:46 am Post subject: checking Required fields ...WMQI |
|
|
Voyager
Joined: 07 May 2004 Posts: 97
|
Hi Missam,
Thanq very much for your time. Actuvally in my case i have to develope exception also by using which field is missing ...like...last name field missing like that....so any suggestions .Once again thanq very much.
Regards,
Bindu |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue May 18, 2004 11:59 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So your current code looks like
IF (test Variable1 to see if it's missing) THEN
set indicator that Variable1 is missing
end if;
If (test Variable2 to see if it's missing) THEN
set indicator that Variable2 is missing
end if;
...
if (test Variable20 to see if it's missing) THEN
set indicator that Variable20 is missing
end if;
(Create message using indicators)
And you're looking to write "less" code to do this. Why?
Are you having performance problems? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bindu |
Posted: Tue May 18, 2004 12:06 pm Post subject: checking Required fields ...WMQI/MQSI |
|
|
Voyager
Joined: 07 May 2004 Posts: 97
|
Hi Jef,
I dont have any perfomance problems....but only thing is i am interested to learn this thing....let me know if Is there any another way to check (less code)...Thanx for your time.
Regards,
bindu |
|
Back to top |
|
 |
Missam |
Posted: Tue May 18, 2004 12:23 pm Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
|
Back to top |
|
 |
|