AnsweredAssumed Answered

Filter records based on Condition

Question asked by dinesh.mallempati104426 on Oct 12, 2018
Latest reply on Oct 13, 2018 by leif_jacobsen

Hi Harikrishna BonalaSeth DudaMichael Morthala Britto ParthalomewSjaak OvergaauwLeif Jacobsen

 

REQ: if DTM01DateTimeQualifier matches any of below codes then we need to pick those records and again we need to filter by below condition order wise and finally we need to pick only one record based on condition.


1)appointment_delivery_dt codes ('104')
2)scheduled_delivery_dt codes ('02', '002', '70', '178', '569', '218')
3) earliest_planned_delivery_dt codes ('53', '064', '170', '071')
4) latest_planned_delivery_dt codes ('031', '001', '773', '074', '54', '063')
5)scheduled_ship_dt codes ('10', '010', '69')
6) latest_planned_ship_dt codes ('38', '938', '175')

Condition:
IF appointment_delivery_dt is null then scheduled_delivery_dt, if null then earliest_planned_delivery_dt, if null then latest_planned_delivery_dt, if null then scheduled_ship_dt,if null then latest_planned_ship_dt

 

Input:
<?xml version="1.0" encoding="UTF-8"?>
<Transmission>
<TransmissionHeader>
<DTMDateTimeReference>
<DTM01DateTimeQualifier>001</DTM01DateTimeQualifier>
<DTM02Date>20180712</DTM02Date>
</DTMDateTimeReference>
<DTMDateTimeReference>
<DTM01DateTimeQualifier>175</DTM01DateTimeQualifier>
<DTM02Date>20180723</DTM02Date>
</DTMDateTimeReference>
<DTMDateTimeReference>
<DTM01DateTimeQualifier>118</DTM01DateTimeQualifier>
<DTM02Date>20180730</DTM02Date>
</DTMDateTimeReference>
<DTMDateTimeReference>
<DTM01DateTimeQualifier>002</DTM01DateTimeQualifier>
<DTM02Date>20180726</DTM02Date>
</DTMDateTimeReference>
<DTMDateTimeReference>
<DTM01DateTimeQualifier>999</DTM01DateTimeQualifier>
<DTM02Date>20180326</DTM02Date>
</DTMDateTimeReference>
</TransmissionHeader>
</Transmission>

 


Expected Output is:
<?xml version="1.0" encoding="UTF-8"?>
<Transmission>
<TransmissionHeader>
<DTMDateTimeReference>
<DTM01DateTimeQualifier>002</DTM01DateTimeQualifier>
<DTM02Date>20180726</DTM02Date>
</DTMDateTimeReference>
</TransmissionHeader>
</Transmission>

 

Thanks,

Dinesh

Outcomes