What kind of validation customers need to care about?

Comments

3 comments

  • Avatar
    Admin

    IsValid validates only the transaction itself and not the transaction as part of a functional group or interchange. BTW the demo does not support validation at all, you need to refer to the SDK for validation with 837P only.

    This type of validation is applied with AckMan when generating 997 or 999 acknowledgments (see Acknowledgment samples in the SDK).

    You can always check if the parsed transaction types are the same:

     var items = new List<EdiMessage>();
    using (var ediReader = new X12Reader(File.OpenRead("yourfile.txt"), LoadFactory))
    {
    while (ediReader.Read())
    {
    if (ediReader.Item is EdiMessage msg)
    items.Add(msg);
    }
    }
    var areAll837P = items.All(t => t.GetType() == typeof(TS837));
  • Avatar
    Omar Salas

    What happend if i have two well defined functional group, one HC (837p) and other for 270, the All query will return False cauze there are 270 EdiMessage

  • Avatar
    Admin (Edited )

    You can rework it to add items to separate groups and then execute the All query against them rather than all the items, something like this:

     var items = new List<Tuple<GS, EdiMessage>>();
    using (var ediReader = new X12Reader(File.OpenRead("yourfile.txt"), LoadFactory)))
    {
    while(ediReader.Read())
    {
    if (ediReader.Item is EdiMessage msg)
    items.Add(new Tuple<GS, EdiMessage>(ediReader.CurrentGroupHeader, msg));
    }
    }

    var fGroups = items.GroupBy(i => i.Item1.GroupControlNumber_6);
    foreach(var fGroup in fGroups)
    {
    var areAll837P = fGroup.All(t => t.Item2.GetType() == typeof(TS837));
    }

Please sign in to leave a comment.