diff --git a/PROMS/DataLoader/Steps.cs b/PROMS/DataLoader/Steps.cs index 81525d2d..271700de 100644 --- a/PROMS/DataLoader/Steps.cs +++ b/PROMS/DataLoader/Steps.cs @@ -109,7 +109,12 @@ namespace DataLoader //string fixStpText = FixStepText(stptext,content.Type); string fixStpText = ""; if (IsATable(content.Type)) + { fixStpText = ConvertTableToGrid(stptext, content, fmt, isROTable); + int? typ = ConvertTableType(content, fmt); + if (typ != null) content.Type = typ; + else _ContentMigrationErrors.Add(content.ContentID, null); + } else fixStpText = FixStepText(stptext); if (fixStpText != stptext) @@ -232,7 +237,7 @@ namespace DataLoader if ((nxttok = tkstring.IndexOf("\x3\x3")) > -1) // Enhanced Override Tab { - Console.WriteLine("Override Tab: {0}", tkstring.Substring(nxttok + 1)); + //Console.WriteLine("Override Tab: {0}", tkstring.Substring(nxttok + 1)); ci.AddItem("Step", "OverrideTab", tkstring.Substring(nxttok + 2)); recdirty = true; //recdirty |= AddContentDetail(content, STP_OVR_TAB, tkstring.Substring(nxttok + 2)); @@ -241,7 +246,7 @@ namespace DataLoader if ((nxttok = tkstring.IndexOf("\x3")) > -1) //Linked Sequence { - Console.WriteLine("Linked Seq: {0}", tkstring.Substring(nxttok + 1)); + //Console.WriteLine("Linked Seq: {0}", tkstring.Substring(nxttok + 1)); ci.AddItem("Step", "LinkedSeq", TextConvert.ConvertSeq(tkstring.Substring(nxttok + 1))); recdirty = true; //recdirty |= AddContentDetail(content, STP_LNK_SEQ, TextConvert.ConvertSeq(tkstring.Substring(nxttok + 1))); @@ -301,6 +306,25 @@ namespace DataLoader return item; } + private int? ConvertTableType(Content content, FormatInfo fmt) + { + // set the type to the first format type from this step type walking up the stepdata format + // data until finding a !InActive. + bool inactive = true; + int indx = (int)content.Type - 20000; + while (inactive) + { + StepData stpData = fmt.PlantFormat.FormatData.StepDataList[indx]; + if (!stpData.Inactive) return (Convert.ToInt32(stpData.Index) + 20000); + // find parent node, i.e. Type="parentType" + string parType = stpData.ParentType; + foreach (StepData sd in fmt.PlantFormat.FormatData.StepDataList) + if (parType == sd.Type) indx = (int)sd.Index; + inactive = stpData.Inactive; + } + return null; + } + private Regex _ReplaceSpaceNewLine = new Regex(@"(?<=\\[^' \\?\r\n\t]*) (?=\r\n)"); private Regex _ReplaceTokenSpaceToken = new Regex(@"(?<=\\[^' \\?\r\n\t]*) (?=\\)"); private string FixStepText(string stepText)