ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » If Value is blank for CREATE LAST CHILD, should not populate

Post new topic  Reply to topic
 If Value is blank for CREATE LAST CHILD, should not populate « View previous topic :: View next topic » 
Author Message
sarat
PostPosted: Sun May 31, 2009 11:56 pm    Post subject: If Value is blank for CREATE LAST CHILD, should not populate Reply with quote

Centurion

Joined: 29 Jun 2005
Posts: 136
Location: India

Hi Everyone,


I need help while creating lastchild...

The below code working fine.

Code:
CREATE LASTCHILD OF outRef AS OUTref NAMESPACE xxxns NAME 'COMMON' VALUE THE(SELECT ITEM X.Value FROM xyzRef.ABC[] AS X WHERE X.Name = 'one');


Am creating same child 'COMMON' 10 times.

Now, the problem is.. I need to create the child if and only if the X.Value is not blank. If it's blank, I should not populate the corresponding 'COMMON'

I've tried with NULL and NULLIF .. But no luck... Please give me some suggestion.

With Regards,
Sarat.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jun 01, 2009 12:04 am    Post subject: Re: If Value is blank for CREATE LAST CHILD, should not popu Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

sarat wrote:
Now, the problem is.. I need to create the child if and only if the X.Value is not blank. If it's blank, I should not populate the corresponding 'COMMON'

I've tried with NULL and NULLIF .. But no luck... Please give me some suggestion.


Will the field be blank, or will the field be NULL? If it's blank then testing for NULL will not give you the results you want (obviously enough!)
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sarat
PostPosted: Mon Jun 01, 2009 12:11 am    Post subject: Reply with quote

Centurion

Joined: 29 Jun 2005
Posts: 136
Location: India

Hi Vitor,

Tx for the response..

I mean to say the value is blank
_________________
With Regards,
Sarat.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jun 01, 2009 12:24 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

sarat wrote:
I mean to say the value is blank


Then I stand by my assertion that neither NULL nor NULLIF will correctly detect blanks, though both are storming at detecting NULLs!

You'll need to replace the NULL test in whatever code you've constructed with a test for blanks. AFAIK the construction

Code:
IF XYZRef.X IS NULL


can't simply be replaced with

Code:
IF XYZRef.X IS BLANK


but you get the idea
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sarat
PostPosted: Mon Jun 01, 2009 12:45 am    Post subject: Reply with quote

Centurion

Joined: 29 Jun 2005
Posts: 136
Location: India

Under XYZRef, there wil be Name and Value pair.

<XYZ>
<Name>one</Name>
<Value></Value>
</XYZ>
<XYZ>
<Name>two</Name>
<Value>123</Value>
</XYZ>

Like this...
_________________
With Regards,
Sarat.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jun 01, 2009 12:50 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

So I extend my original question: is the field blank, is the field NULL, is the field not present or is the field present but childless?

Work out the various permutations of the field contents, then test apprpriately.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sarat
PostPosted: Mon Jun 01, 2009 1:17 am    Post subject: Reply with quote

Centurion

Joined: 29 Jun 2005
Posts: 136
Location: India

Vitor,

This can be done in other way...

either using FOR loop and check each and every Name and Value combination is present.. If present the create last child..

Else another solution is.. Set the value to an Environment variable, and check if that's not blank then create last child..

But I want to minimal the code .. Is there any chance to get this thing done in other way?
_________________
With Regards,
Sarat.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jun 01, 2009 1:57 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

If it's simply a question of all Value children with actual values being COMMON, then I would expect something like:

Code:
SELECT SELECT ITEM X.Value FROM xyzRef.ABC[] AS X WHERE X.Value IS NOT NULL


(untested, written from memory, etc)

to work.

What happened with that?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sarat
PostPosted: Mon Jun 01, 2009 2:05 am    Post subject: Reply with quote

Centurion

Joined: 29 Jun 2005
Posts: 136
Location: India

No Luck Vitor ...

Coz.. CREATE LAST CHILD creating the element with blank..(I guess)
_________________
With Regards,
Sarat.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jun 01, 2009 2:14 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

sarat wrote:
Coz.. CREATE LAST CHILD creating the element with blank..(I guess)


Take a user trace and remove guesswork. See what this "blank" element is actually being interpreted as.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Jun 01, 2009 3:44 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You can also test if the fieldlength is > 0.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
sarat
PostPosted: Mon Jun 01, 2009 4:16 am    Post subject: Reply with quote

Centurion

Joined: 29 Jun 2005
Posts: 136
Location: India

Ok.. First it's creating the child and trying to assign the value..

If not found, leaving the child as it's..

Got the solution at last..

Code:
CREATE LASTCHILD OF outRef AS OUTref NAMESPACE xxxns NAME 'COMMON'

SET OUTref =THE(SELECT ITEM X.Value FROM xyzRef.ABC[] AS X WHERE X.Name = 'one' AND X.Value <>'');


Tx for all you support
_________________
With Regards,
Sarat.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » If Value is blank for CREATE LAST CHILD, should not populate
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.