EDI.Net icon indicating copy to clipboard operation
EDI.Net copied to clipboard

Combine condition with value

Open MikeCrutchfield opened this issue 2 years ago • 2 comments

I am trying to do something like this, but can't get the syntax correct. I am trying to fill in the associated property based on the Condition.

Thanks for any help.

[EdiCondition("010", Path = "DTM/0"), EdiValue(Path = "DTM/1", Format = "yyyyMMdd", Description = "DTM02 - Date format = CCYYMMDD")]
public DateTime RequestedShipDate { get; set; }

[EdiCondition("038", Path = "DTM/0"), EdiValue(Path = "DTM/1", Format = "yyyyMMdd", Description = "DTM02 - Date format = CCYYMMDD")]
public DateTime ShipNoLaterDate { get; set; }

I get nulls for the properties with the above syntax

The incoming segment is like this:

DTM*010*20230204~
DTM*038*20230206~

MikeCrutchfield avatar Feb 01 '23 20:02 MikeCrutchfield

Unfortunately Conditions do not work directly on values (components). You will have to make a wrapper class for the DTM in order for this to work. Check a sample here https://github.com/indice-co/EDI.Net/blob/ff0ed2b159ba01af55f52b5f34c8486507d801c4/test/indice.Edi.Tests/Models/X12_850.cs#L251

cleftheris avatar Feb 02 '23 09:02 cleftheris

Thanks!

MikeCrutchfield avatar Feb 02 '23 13:02 MikeCrutchfield