Author |
Message
|
goldym |
Posted: Thu Jul 07, 2005 1:09 pm Post subject: FIELDTYPE AND FIELDVALUE Usages |
|
|
Centurion
Joined: 24 Jun 2005 Posts: 116
|
I was wondering if anyone had a similar problem.
I need to two checks
1. To see if an ELEMENT exists, if it doesn't write and exception
2. To see if the element exists, if it does, I need to check to see if there is a value there. I am usng FIELDTYPE and FIELDVALUE.
However I am getting the same results whether the element is there with a null value or not. Its skipping the first check (Error condition '2')
ESQL:
WHEN messageType = 'TEST' THEN
IF FIELDTYPE(cobDate) IS NULL THEN
SET exceptionType = '2';
SET exceptionDescription = 'Message header tags do not match structure';
CALL NULL_DUMMY(messageType );
ELSE IF FIELDVALUE(cobDate) IS NULL THEN
SET exceptionType = '3';
SET exceptionDescription = 'Message header field values are blank';
CALL NO_DUMMY(messageType) |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jul 07, 2005 1:43 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I'm assuming "cobDate" is a reference to an element, or something?
Just check if it's NULL on it's own, don't bother with FIELDTYPE.
Or, heck, use COALESCE to assign a default value if it's null, and then see if the result is the default value. Covers both cases in one swoop. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
goldym |
Posted: Thu Jul 07, 2005 1:49 pm Post subject: |
|
|
Centurion
Joined: 24 Jun 2005 Posts: 116
|
Will just checking to see if its null allow me to do two different exceptions. I have to check to see if its there, then if its there check to see if its null? |
|
Back to top |
|
 |
Tibor |
Posted: Thu Jul 07, 2005 2:56 pm Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Can you post the whole code, especially the declaration and setting of variable cobDate?
Tibor |
|
Back to top |
|
 |
goldym |
Posted: Thu Jul 07, 2005 3:13 pm Post subject: |
|
|
Centurion
Joined: 24 Jun 2005 Posts: 116
|
I removed the REFERENCE variables and added the full Path. and the logic seemed to work. |
|
Back to top |
|
 |
anpati1 |
Posted: Thu Jun 14, 2007 2:16 am Post subject: |
|
|
Novice
Joined: 07 Jun 2007 Posts: 24 Location: Marlow, UK
|
Im trying to evaluate if an element is empty or not. The help doc does not tell what the return value is for an empty element when I use FIELDVALUE() or COALESCE().
I'm working on XMLNSC domain message.
Thanks in advance,
Anand |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 14, 2007 6:26 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
|