Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regarding Type designer rule

Status
Not open for further replies.

panparag

Programmer
Jul 11, 2006
1
US
Hi,
I have a segment named 'RFF' segment in my input file which can have occurances of (1:3).This RFF segment has an element named 'Qual'. Now I want to implement a business logic that at least one occurence of this segment should be equal to "CR". In other words at least one Qaul:RFF ="CR".

I have written a rule in the type tree of this segment. The rule is as follwing:

WHEN( PRESENT($),
IF(Qual:RFF:$[1]="CR" |
Qual:RFF:$[2]="CR" |
Qual:RFF:$[3]="CR" ,TRUE,FALSE))

This rule is not working and even if the none of the required value is CR, it is processed successfuly and no invalid inputs are given.

Please help in resolving the issue. This is very critical issue and I want some urgent suggestions.

Thanks
 
Don't need the "when" AFAIK, the present function has this logic. Then the TRUE/FALSE doesn't change the processing of the data. Not sure if FAIL in a type tree works.



BocaBurger
<===========================||////////////////|0
The pen is mightier than the sword, but the sword hurts more!
 
Hi Panparag,

I would move the rule into the transformation map - if the rule is in the type tree you'll get a fairly meaningless "input invalid" error or similar.

If the rule is in the map (possibly you could have a validation output card first) you can fail the map with something meaningful (plus the rule should be easier to define) -
IF (ABSENT (LOOKUP (Qual:RFF:Message, Qual:RFF:Message="CR")), FAIL ("CR refernce is missing"))

If you have to do it in the type tree then a rule like:
Qual'r Element:.:$[1]="9" |
Qual'r Element:.:$[2]="9" |
Qual'r Element:.:$[3]="9"
on the RFF segment should work.

cheers,
Olly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top