Author |
Message
|
amittalekar |
Posted: Mon Apr 29, 2002 10:34 am Post subject: |
|
|
 Disciple
Joined: 03 Apr 2002 Posts: 166 Location: VA, USA
|
Hi,
I am trying to access the container members of a workitem,
But the problem is that if there is no values set it is throwing an exception 'container member not set',
To avoid this currently we are putting each call to the get method in a try-catch block. Is there a way to suppress these exceptions. I am attaching a sample piece of code for your reference.
ReadOnlyContainer roc = wi.inContainer();
CaseInfoDSVO caseInfo = new CaseInfo();
try{
caseInfo.setCaseId(roc.getString("caseInfo.caseId"));
}catch(Exception ex){
ex.printStackTrace();
}
try{
caseInfo.setWorkId(roc.getString("caseInfo.workId"));
}catch(Exception ex){
ex.printStackTrace();
}
try{
caseInfo.setFirstName(roc.getString("caseInfo.firstName"));
}catch(Exception ex){
ex.printStackTrace();
}
try{
caseInfo.setLastName(roc.getString("caseInfo.lastName"));
}catch(Exception ex){
ex.printStackTrace();
}
Can anyone help me on this please. ? |
|
Back to top |
|
 |
jpappas |
Posted: Mon Apr 29, 2002 11:09 am Post subject: |
|
|
Newbie
Joined: 23 Apr 2002 Posts: 5
|
Are you sure your workflow is passing along the container? Do you you have a default workflow? Do you have a data connector from the source to the sink in case you don't have a default workflow? If you don't have a default flow and none of the transition conditions are met the process ends without moving the container along. Hope this helps.
Joe
[ This Message was edited by: jpappas on 2002-04-29 12:14 ] |
|
Back to top |
|
 |
amittalekar |
Posted: Mon Apr 29, 2002 11:45 am Post subject: |
|
|
 Disciple
Joined: 03 Apr 2002 Posts: 166 Location: VA, USA
|
Hello,
I have a workItem which has some values already in the container.
I am talking about the container members which doesn't contain any value i.e null. My Question is whenever i read such container members (e.g getString) , workflow will throw FMC exzception with message "Container member not set".
Is there any way to avoid FMCException being thrown in this case.
I want this to improve WorkFlow performance....
can this be done?
waiting |
|
Back to top |
|
 |
jmac |
Posted: Mon Apr 29, 2002 5:13 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
This is working as designed. Also, be aware that the member is not null, it is NOT SET, there is a huge difference between getting a Member Not Set, and having a string container member with a value of a null string. The code you are showing is what I would expect to see.
_________________ John McDonald
RETIRED |
|
Back to top |
|
 |
vedbhat |
Posted: Mon Apr 29, 2002 5:35 pm Post subject: |
|
|
 Disciple
Joined: 19 Mar 2002 Posts: 186 Location: Singapore
|
Hi,
Inorder th suppress the message before you use,
"roc.getString("caseInfo.caseId")"
"roc.getString("caseInfo.workId")"...
check whether the value is empty using the isEmpty() method and then take appropriate action.
I hope this help. You can check the sample provided for more information.
Cheers
Ved
_________________ IBM Certified Solutions Expert - MQSeries Workflow
IBM Certified Specialist - MQSeries |
|
Back to top |
|
 |
jmac |
Posted: Tue Apr 30, 2002 5:59 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Ved:
The isEmpty method is NOT at the member level:
boolean isEmpty()
Indicates whether no container information is available.
If you are working with the container, I don't think there is anyway around getting the Member Not Set return code when querying a member.
What sample are you referring to?
_________________ John McDonald
RETIRED |
|
Back to top |
|
 |
amittalekar |
Posted: Tue Apr 30, 2002 6:07 am Post subject: |
|
|
 Disciple
Joined: 03 Apr 2002 Posts: 166 Location: VA, USA
|
Ved,
I have the exact same question which Jmac has asked...
|
|
Back to top |
|
 |
vedbhat |
Posted: Wed May 01, 2002 5:49 pm Post subject: |
|
|
 Disciple
Joined: 19 Mar 2002 Posts: 186 Location: Singapore
|
Hi,
In the FMCNSHOW sample, the method "Private Sub ShowInput()" checks whether the container Element is Empty or not.
If this is supported using ActiveX, There should be a way to handle this using Java.
Cheers
Ved
_________________
IBM Certified Solutions Expert - MQSeries Workflow
[ This Message was edited by: vedbhat on 2002-05-01 22:05 ] |
|
Back to top |
|
 |
jmac |
Posted: Thu May 02, 2002 7:22 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Ved:
You are mistaken that the VB api handles this. Have a look at line 526 in the V3302 version (If rc = 113 Then) This is what is detecting the fact that the Member is not set. The code I believe you are referring to is like this on line 408 ( If coeElement.IsEmpty Then WriteStatus ("One element was empty and could not be read!") ), I believe that this is NEVER true, if it were there would be a huge problem with the container.
Java handles exceptions BETTER than most languages in that it FORCES the programmer to do what they should be doing anyway, checking return codes. Granted it is a bit of a pain to have to write the code this way, but it is most definitely the BEST way to do it.
_________________ John McDonald
RETIRED |
|
Back to top |
|
 |
vedbhat |
Posted: Thu May 02, 2002 5:45 pm Post subject: |
|
|
 Disciple
Joined: 19 Mar 2002 Posts: 186 Location: Singapore
|
Hi John,
Thanks for clearing my mis-understanding. I haven't tried this so far but will try sometime.
Regards
Ved
_________________ IBM Certified Solutions Expert - MQSeries Workflow
IBM Certified Specialist - MQSeries |
|
Back to top |
|
 |
amittalekar |
Posted: Fri May 03, 2002 7:36 am Post subject: |
|
|
 Disciple
Joined: 03 Apr 2002 Posts: 166 Location: VA, USA
|
Hi Jmac & Ved,
First of all thanks for sharing ur opinions.....
So the conclusion is I can not change anything in the code.
What happen behind the scene when ReadOnlyContainer object (workItem.inContainer()) is created or reading the values from container using getString methods.
In then other words...
Whether the MQ Server queries back to DB2 database for the above mensioned calls?...
If so, then is there any other option by which I can retrive all the container values of a workItem along with workItem?...
|
|
Back to top |
|
 |
jmac |
Posted: Fri May 03, 2002 10:35 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
It is my understanding that the first call for any specific container element will bring the entire container to you.
_________________ John McDonald
RETIRED |
|
Back to top |
|
 |
vedbhat |
Posted: Sun May 05, 2002 6:38 pm Post subject: |
|
|
 Disciple
Joined: 19 Mar 2002 Posts: 186 Location: Singapore
|
Hi,
I modified Credit Sample and doesn't set any value in the first Activity.
In the second activity, I tried the code as below and it doesn't throw any error saying 'container member not set'.
I hope this is what you are trying to do.
Code
====
Set cnrIn = ContainerCtrlIn.Container
rc = cnrIn.InContainer
If (rc <> 0) Then
MsgBox "Getting input container failed (rc = " & rc & ").", 16, "Error"
End If
' Get the Leaves type Container Element
Set coaStructLeaves = cnrIn.ContainerElementArray(TypeLeaves)
Call cnrIn.Leaves(coaStructLeaves)
' For each of the element in leaves get the value from the container and assign to variable
For CurrentIndex = 0 To coaStructLeaves.GetSize - 1
Set coeElement = coaStructLeaves.GetAt(CurrentIndex)
ElementName = coeElement.FullName
MsgBox "Current Index : " & CurrentIndex & " Current Element : " & ElementName
Select Case (ElementName)
Case "CreditRequestor.FirstName":
rc = coeElement.GetValueStr(firstname, ArrayIndex)
Case "CreditRequestor.LastName":
rc = coeElement.GetValueStr(lastname, ArrayIndex)
Case "Address":
rc = coeElement.GetValueStr(address, ArrayIndex)
Case "CreditAmount":
rc = coeElement.GetValueLng(amount, ArrayIndex)
End Select
If (rc <> 0) Then
MsgBox "Error Reading Input Container."
End If
Next
Regards
Ved
_________________ IBM Certified Solutions Expert - MQSeries Workflow
IBM Certified Specialist - MQSeries |
|
Back to top |
|
 |
jmac |
Posted: Mon May 06, 2002 7:03 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Ved:
IF you are not getting "Member Not Set" (rc 113), then the member has data in it. Possibly a zero length string. But the member has definitely had data put into it by someone, or else MQWF is BROKEN.
How did you start this instance? Using the IBM supplied dialog from Create And Start instance in VB client? IF so, that's your problem, this has been broken (in my opinion) since DAY 1 of MQWR. It sets all variables in your input container to zero length strings.
I need more information if you did not start using IBM Fat client. Please send me your code.
_________________ John McDonald
RETIRED |
|
Back to top |
|
 |
vedbhat |
Posted: Mon May 06, 2002 5:50 pm Post subject: |
|
|
 Disciple
Joined: 19 Mar 2002 Posts: 186 Location: Singapore
|
Hi,
Yes, You are correct. In the first activity, even if the variable doesn't have any value it sets empty string when used "cnrOut.SetValue...." but if I remove this setValue statement then rc is returned as 113, which can be trapped and handle error conditions easily. So, I dont see any problem with this.
I am using IBM MQWF Fat client and I tested the process by both using "Create and Start Instance" and also "Create Instance and then Start Instance".
Thanks for the info.
Regards
Ved
_________________ IBM Certified Solutions Expert - MQSeries Workflow
IBM Certified Specialist - MQSeries |
|
Back to top |
|
 |
|