锅炉信息网 > 锅炉知识 > 锅炉百科

29...

发布时间:

//Short Description: Add VS01 and show Weight / WeightU flieds in CND1(N=2,3,4).n        //Modification History: Created

//Short Description: Add VS01 and show Weight / WeightU flieds in CND1(N=2,3,4).n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint input_DP = afp.ActionDataPoint;n Subject currentSubject = input_DP.Record.Subject;n Instance current_ins = input_DP.Record.DataPage.Instance;n CRFVersion crfv = currentSubject.CRFVersion;n string formOID = "VS01";n string field_1 = "HEIGHT";n string field_2 = "HEIGHTU";n string field_3 = "WEIGHT";n string field_4 = "WEIGHTU";n DataPoint field1;n DataPoint field2;n DataPoint field3;n DataPoint field4;n bool Folder_Match = false;n Form VS01_FORM = Form.FetchByOID(formOID, currentSubject.CRFVersion.ID);n string[] DSLFolders =n {n "C2D1",n "C3D1",n "C4D1",n "EOT",n }n ;nn for (int k = 0; k < DSLFolders.Length; k++)n {n string Each_Folder = DSLFolders[k];n if (current_ins.Folder.OID == Each_Folder)n {n Folder_Match = true;n break;n }n }n if (Folder_Match == true)n {nn if (current_ins != null && current_ins.Active && current_ins.Folder.OID != "C" && input_DP != null && input_DP.Active && input_DP.Data == "Y")n {n DataPage VS01_Datapage = current_ins.DataPages.FindByFormOID(formOID);n if (VS01_Datapage == null)n {n current_ins.AddCRF(VS01_FORM, input_DP.Record.SubjectMatrixID);n field3 = current_ins.DataPages.FindByFormOID(formOID).MasterRecord.DataPoints.FindByFieldOID(field_3);n field4 = current_ins.DataPages.FindByFormOID(formOID).MasterRecord.DataPoints.FindByFieldOID(field_4);n field3.IsVisible = true;n field4.IsVisible = true;n }n if (VS01_Datapage != null && !VS01_Datapage.Active)n {n VS01_Datapage.Active = true;n }nn return null;nn }n elsen {n DataPage VS01_Datapage = current_ins.DataPages.FindByFormOID(formOID);n if (VS01_Datapage != null && current_ins.Folder.OID != "C")n {n VS01_Datapage.Active = false;n }n elsen {n return null;n }n }n }n return null;

2

//Description: Trigger/Rename CNDNnn const string StartCycle_OID = "C4D8";n const string repeatCycle_OID = "C";n const string addMatrix_OIDCNDN = "CNDN";nn int maxRepeatNumber = 0;n int intCount = 0;nn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpAct = afp.ActionDataPoint;nn Subject subject = dpAct.Record.Subject;n Instance currentInstance = dpAct.Record.DataPage.Instance;n string currentInstance_OID = currentInstance.Folder.OID;n int currentInstance_RepeatNo = currentInstance.InstanceRepeatNumber;nn Matrix nextMatrix;n Instance nextInstance;nn if ((currentInstance_OID != StartCycle_OID && currentInstance_OID != repeatCycle_OID) || !dpAct.IsObjectChanged)n return null;nn Instances allInstances = subject.Instances;n for (int i = 0; i < allInstances.Count; i++)n {n if (allInstances[i].Folder.OID == repeatCycle_OID)n {n intCount++;n if (allInstances[i].InstanceRepeatNumber > maxRepeatNumber)n maxRepeatNumber = allInstances[i].InstanceRepeatNumber;n }n }nn if (dpAct.Data == "Y" && ((currentInstance_OID == StartCycle_OID && intCount == 0) || (currentInstance_OID == repeatCycle_OID && currentInstance_RepeatNo == maxRepeatNumber)))n {n nextMatrix = Matrix.FetchByOID(addMatrix_OIDCNDN, subject.CRFVersionID);n subject.AddMatrix(nextMatrix);nn if (currentInstance_OID == StartCycle_OID)n nextInstance = FindLastInstance(allInstances, repeatCycle_OID, maxRepeatNumber);n elsen nextInstance = FindLastInstance(allInstances, repeatCycle_OID, maxRepeatNumber + 1);nn string instanceName;n if (currentInstance_OID == StartCycle_OID)n {n instanceName = string.Concat("5 Day 1");n nextInstance.SetInstanceName(instanceName);n }n elsen {n if (nextInstance != null && currentInstance_OID == repeatCycle_OID)n {n if (currentInstance_RepeatNo % 2 == 0)n {n instanceName = string.Concat((currentInstance_RepeatNo / 2 + 5).ToString(), " Day 8");n nextInstance.SetInstanceName(instanceName);n }n elsen {n instanceName = string.Concat(((currentInstance_RepeatNo - 1) / 2 + 6).ToString(), " Day 1");n nextInstance.SetInstanceName(instanceName);n }n }n }n }nn else if ((currentInstance_OID == StartCycle_OID && intCount == 1) || (currentInstance_OID == repeatCycle_OID && currentInstance_RepeatNo == maxRepeatNumber - 1))n {n nextInstance = FindLastInstance(allInstances, repeatCycle_OID, maxRepeatNumber);n if (nextInstance != null)n {n if (dpAct.Data == "N" && nextInstance.Active == true)n nextInstance.Active = false;n else if (dpAct.Data == "Y" && nextInstance.Active == false)n nextInstance.Active = true;n }n }n return null;n }n private Instance FindLastInstance(Instances instances, string folderOID, int repeatNumber)n {n Instance returnInstance = null;n for (int i = 0; i < instances.Count; i++)n {n if (instances[i].Folder.OID == folderOID && instances[i].InstanceRepeatNumber == repeatNumber)n {n returnInstance = instances[i];n break;n }n }n return returnInstance;nCSharpt nCF_DYN_MTX_CND1

3

//Description: Add from to CND1 (CheckStep)nn DataPoint dpStep = (DataPoint) ThisObject;n Instance currentInstance = dpStep.Record.DataPage.Instance;nn string currentInstance_OID = currentInstance.Folder.OID;n int currentInstance_RepeatNo = currentInstance.InstanceRepeatNumber;nn if (currentInstance != null && currentInstance.Active)n {n if (currentInstance_OID == "C" && currentInstance_RepeatNo % 2 == 0)n return true;n }n return false;

4

//Short Description: Rename instance, when SVTPT is entered.n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint input_DP = afp.ActionDataPoint;nn Subject subj = input_DP.Record.Subject;n Instance current_ins = input_DP.Record.DataPage.Instance;n string current_OID = current_ins.Folder.OID;n int currRepeatNo = current_ins.InstanceRepeatNumber;nn if (input_DP != null && input_DP.Active && input_DP.Data != string.Empty)n {n String SVTPT = input_DP.UserValue().ToString();n //String ins_order = Convert.ToString(currRepeatNo + 1);n //String ins_name = ins_order + "_" + SVTPT;n current_ins.SetInstanceName(SVTPT);n }nnn return null;

5

//Description: Trigger/Rename CNDNnn const string StartCycle_OID = "C4D8";n const string repeatCycle_OID = "C";n const string addMatrix_OIDCNDN = "CNDN";nn int maxRepeatNumber = 0;n int intCount = 0;nn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpAct = afp.ActionDataPoint;nn Subject subject = dpAct.Record.Subject;n Instance currentInstance = dpAct.Record.DataPage.Instance;n string currentInstance_OID = currentInstance.Folder.OID;n int currentInstance_RepeatNo = currentInstance.InstanceRepeatNumber;nn Matrix nextMatrix;n Instance nextInstance;nn if ((currentInstance_OID != StartCycle_OID && currentInstance_OID != repeatCycle_OID) || !dpAct.IsObjectChanged)n return null;nn Instances allInstances = subject.Instances;n for (int i = 0; i < allInstances.Count; i++)n {n if (allInstances[i].Folder.OID == repeatCycle_OID)n {n intCount++;n if (allInstances[i].InstanceRepeatNumber > maxRepeatNumber)n maxRepeatNumber = allInstances[i].InstanceRepeatNumber;n }n }nn if (dpAct.Data == "Y" && ((currentInstance_OID == StartCycle_OID && intCount == 0) || (currentInstance_OID == repeatCycle_OID && currentInstance_RepeatNo == maxRepeatNumber)))n {n nextMatrix = Matrix.FetchByOID(addMatrix_OIDCNDN, subject.CRFVersionID);n subject.AddMatrix(nextMatrix);nn if (currentInstance_OID == StartCycle_OID)n nextInstance = FindLastInstance(allInstances, repeatCycle_OID, maxRepeatNumber);n elsen nextInstance = FindLastInstance(allInstances, repeatCycle_OID, maxRepeatNumber + 1);nn string instanceName;n if (currentInstance_OID == StartCycle_OID)n {n instanceName = string.Concat("5 Day 1");n nextInstance.SetInstanceName(instanceName);n }n elsen {n if (nextInstance != null && currentInstance_OID == repeatCycle_OID)n {n if (currentInstance_RepeatNo % 2 == 0)n {n instanceName = string.Concat((currentInstance_RepeatNo / 2 + 5).ToString(), " Day 8");n nextInstance.SetInstanceName(instanceName);n }n elsen {n instanceName = string.Concat(((currentInstance_RepeatNo - 1) / 2 + 6).ToString(), " Day 1");n nextInstance.SetInstanceName(instanceName);n }n }n }n }nn else if ((currentInstance_OID == StartCycle_OID && intCount == 1) || (currentInstance_OID == repeatCycle_OID && currentInstance_RepeatNo == maxRepeatNumber - 1))n {n nextInstance = FindLastInstance(allInstances, repeatCycle_OID, maxRepeatNumber);n if (nextInstance != null)n {n if (dpAct.Data == "N" && nextInstance.Active == true)n nextInstance.Active = false;n else if (dpAct.Data == "Y" && nextInstance.Active == false)n nextInstance.Active = true;n }n }n return null;n }n private Instance FindLastInstance(Instances instances, string folderOID, int repeatNumber)n {n Instance returnInstance = null;n for (int i = 0; i < instances.Count; i++)n {n if (instances[i].Folder.OID == folderOID && instances[i].InstanceRepeatNumber == repeatNumber)n {n returnInstance = instances[i];n break;n }n }n return returnInstance;

6

//Modification History: Createdn //Description: Start date < "Minimum date of Dose in EC01", AEREL select "Yes".nn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n bool OpenQuery = false;n string queryText = "Adverse Event start date is earlier than C1D1 dosing date, but "Is this event related to study drug?" is selected "Yes". Please check and update if applicable. Otherwise, specify.";n DateTime Mindate = DateTime.MaxValue;nn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.CodedValue().ToString() == "Y")n {n DataPoint dpAESTDAT = dpInput.Record.DataPoints.FindByFieldOID("AESTDAT");n if (dpAESTDAT != null && dpAESTDAT.Active && dpAESTDAT.Data != string.Empty && dpAESTDAT.EntryStatus != EntryStatusEnum.NonConformant && dpAESTDAT.MissingCode == null && dpAESTDAT.StandardValue() is DateTime)n {n DataPoints dpMinDat = CustomFunction.FetchAllDataPointsForOIDPath("ECSTDAT", "EC01", "C1D1", dpInput.Record.Subject);n if (dpMinDat.Count > 0)n {n for (int i = 0; i < dpMinDat.Count; i++)n {n if (dpMinDat[i] != null && dpMinDat[i].Active && dpMinDat[i].Data != string.Empty && dpMinDat[i].EntryStatus != EntryStatusEnum.NonConformant && dpMinDat[i].MissingCode == null && dpMinDat[i].StandardValue() is DateTime)n {n DateTime dtTarget = (DateTime) dpMinDat[i].StandardValue();n if (Mindate > dtTarget)n Mindate = dtTarget;n }n }nn DateTime dpTargetDat = (DateTime) dpAESTDAT.StandardValue();n if (dpTargetDat.CompareTo(Mindate) < 0)n OpenQuery = true;n }n }n }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;

7

//Description: Start date = "Minimum date of dose in EC01" and AETMREL select "Before first dose", AEREL select "Yes".nn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n bool OpenQuery = false;n string queryText = "Adverse Event start before first dose, but "Is this event related to study drug?" is selected "Yes". Please check and update if applicable. Otherwise, specify.";n DateTime Mindate = DateTime.MaxValue;nn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.CodedValue().ToString() == "Y")n {n DataPoint dpAESTDAT = dpInput.Record.DataPoints.FindByFieldOID("AESTDAT");n if (dpAESTDAT != null && dpAESTDAT.Active && dpAESTDAT.Data != string.Empty && dpAESTDAT.EntryStatus != EntryStatusEnum.NonConformant && dpAESTDAT.MissingCode == null && dpAESTDAT.StandardValue() is DateTime)n {n DataPoints dpMinDat = CustomFunction.FetchAllDataPointsForOIDPath("ECSTDAT", "EC01", "C1D1", dpInput.Record.Subject);n if (dpMinDat.Count > 0)n {n for (int i = 0; i < dpMinDat.Count; i++)n {n if (dpMinDat[i] != null && dpMinDat[i].Active && dpMinDat[i].Data != string.Empty && dpMinDat[i].EntryStatus != EntryStatusEnum.NonConformant && dpMinDat[i].MissingCode == null && dpMinDat[i].StandardValue() is DateTime)n {n DateTime dtTarget = (DateTime) dpMinDat[i].StandardValue();n if (Mindate > dtTarget)n Mindate = dtTarget;n }n }nn DateTime dpTargetDat = (DateTime) dpAESTDAT.StandardValue();n if (dpTargetDat.CompareTo(Mindate) == 0)n {n DataPoint dpAETMREL = dpInput.Record.DataPage.MasterRecord.DataPoints.FindByFieldOID("AETMREL");n if (dpAETMREL != null && dpAETMREL.Active && dpAETMREL.Data != string.Empty && dpAETMREL.CodedValue().ToString() == "BEFORE FIRST DOSE")n OpenQuery = true;n }n }n }n }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;

8

//Modification History: Createdn //Description: Start date = 1."Minimum date of dose in EC01", but AETMREL is missing.;2.Start date < > "Minimum date of dose in EC01", but AETMREL < > null.nn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;nn bool OpenQuery1 = false;n string queryText1 = "AE start date is equal to C1D1 dosing date, but "If earliest Start Date is equal to First Dose Date, Start timing related to study treatment" is missing. Please check and update if applicable. Otherwise, specify.";n bool OpenQuery2 = false;n string queryText2 = "AE start date is not equal to C1D1 dosing date, but "If earliest Start Date is equal to First Dose Date, Start timing related to study treatment" is provided. Please check and update if applicable. Otherwise, specify.";nn DateTime aeMindat = DateTime.MaxValue;n DateTime ecMindat = DateTime.MaxValue;nn if (dpInput != null && dpInput.Active )n {n Records currentRecords = dpInput.Record.DataPage.Records;n if (currentRecords.Count > 0)n {n foreach (Record currentRecord in currentRecords)n {n DataPoint dpAESTDAT = currentRecord.DataPoints.FindByFieldOID("AESTDAT");n if (dpAESTDAT.Data != string.Empty && dpAESTDAT.EntryStatus != EntryStatusEnum.NonConformant && dpAESTDAT.MissingCode == null && dpAESTDAT.StandardValue() is DateTime)n {n DateTime dpAEDat = (DateTime) dpAESTDAT.StandardValue();n if (aeMindat > dpAEDat)n aeMindat = dpAEDat;n }n }nn DataPoints dpECSTDATs = CustomFunction.FetchAllDataPointsForOIDPath("ECSTDAT", "EC01", "C1D1", dpInput.Record.Subject);n if (dpECSTDATs.Count > 0)n {n for (int i = 0; i < dpECSTDATs.Count; i++)n {n if (dpECSTDATs[i] != null && dpECSTDATs[i].Active && dpECSTDATs[i].Data != string.Empty && dpECSTDATs[i].EntryStatus != EntryStatusEnum.NonConformant && dpECSTDATs[i].MissingCode == null && dpECSTDATs[i].StandardValue() is DateTime)n {n DateTime dtECDat = (DateTime) dpECSTDATs[i].StandardValue();n if (ecMindat > dtECDat)n ecMindat = dtECDat;n }n }nn if (aeMindat< DateTime.MaxValue && ecMindat< DateTime.MaxValue)n {n if (dpInput.Data == string.Empty && aeMindat == ecMindat)n OpenQuery1 = true;n if (dpInput.Data != string.Empty && aeMindat != ecMindat)n OpenQuery2 = true;n }n }n }n }n CustomFunction.PerformQueryAction(queryText1, 1, false, false, dpInput, OpenQuery1, afp.CheckID, afp.CheckHash);n CustomFunction.PerformQueryAction(queryText2, 1, false, false, dpInput, OpenQuery2, afp.CheckID, afp.CheckHash);n return null;

9

//Short Description: Compare Top and Initial graden //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n bool OpenQuery = false;n string queryText = "Top Grade is less than Initial Grade. Please check and update if applicable. Otherwise, specify.";nn DataPoint dpAETOXGRI = dpInput.Record.DataPoints.FindByFieldOID("AETOXGRI");nn if (dpInput.Active && dpInput.Data != string.Empty && dpAETOXGRI.Active && dpAETOXGRI.Data != string.Empty)n {n double dpTop = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(dpInput.Data.ToString(), @"[^0-9]+", ""));n double dpInitial = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(dpAETOXGRI.Data.ToString(), @"[^0-9]+", ""));nn if (dpTop < dpInitial)n OpenQuery = true;n }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;

10

//Description: Start Date < "C1D1 date of Dose in EC01"nn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n bool OpenQuery = false;n string queryText = "Start date was earlier than C1D1 dosing date. Please check and update if applicable. Otherwise, specify.";n DateTime Mindate = DateTime.MaxValue;nn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant && dpInput.MissingCode == null && dpInput.StandardValue() is DateTime)n {n DataPoints dpMinDat = CustomFunction.FetchAllDataPointsForOIDPath("ECSTDAT", "EC01", "C1D1", dpInput.Record.Subject);n if (dpMinDat.Count > 0)n {n for (int i = 0; i < dpMinDat.Count; i++)n {n if (dpMinDat[i] != null && dpMinDat[i].Active && dpMinDat[i].Data != string.Empty && dpMinDat[i].EntryStatus != EntryStatusEnum.NonConformant && dpMinDat[i].MissingCode == null && dpMinDat[i].StandardValue() is DateTime)n {n DateTime dtTarget = (DateTime) dpMinDat[i].StandardValue();n if (Mindate > dtTarget)n Mindate = dtTarget;n }n }nn DateTime dpTargetDat = (DateTime) dpInput.StandardValue();n if (dpTargetDat.CompareTo(Mindate) < 0)n OpenQuery = true;n }n }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;

11均选择未做

ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;nn Subject currentSubject = dpInput.Record.Subject;n string currentInstance = dpInput.Record.Instance.Folder.OID;n string currentDatapage = dpInput.Record.DataPage.Form.OID;nn bool openQuery = true;n string queryText = "'Were PK samples performed?' is Yes, but Not Done for all Planned Time Point are checked. Please confirm and update as appropriate.";nn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.CodedValue().ToString() == "Y")n {n DataPoints dpTargets = CustomFunction.FetchAllDataPointsForOIDPath("PCSTAT", currentDatapage, currentInstance, currentSubject);n if (dpTargets.Count > 0)n {n foreach (DataPoint dpTarget in dpTargets)n {n if (dpTarget != null && dpTarget.Active && dpTarget.Data == string.Empty)n {n openQuery = false;n break;n }n }n }n }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, openQuery, afp.CheckID, afp.CheckHash);n return null;

12

ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;nn Subject currentSubject = dpInput.Record.Subject;n string currentInstance = dpInput.Record.Instance.Folder.OID;n string currentDatapage = dpInput.Record.DataPage.Form.OID;nn bool openQuery = true;n string queryText = "'Were PK samples performed?' is Yes, but Not Done is checked. Please confirm and update as appropriate.";nn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.CodedValue().ToString() == "Y")n {n DataPoints dpTargets = CustomFunction.FetchAllDataPointsForOIDPath("PCSTAT", currentDatapage, currentInstance, currentSubject);n if (dpTargets.Count > 0)n {n foreach (DataPoint dpTarget in dpTargets)n {n if (dpTarget != null && dpTarget.Active && dpTarget.Data == string.Empty)n {n openQuery = false;n break;n }n }n }n }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, openQuery, afp.CheckID, afp.CheckHash);n return null;

13

ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;nn Subject currentSubject = dpInput.Record.Subject;n string currentInstance = dpInput.Record.Instance.Folder.OID;n string currentDatapage = dpInput.Record.DataPage.Form.OID;nn bool openQuery = true;n string queryText = "'Were PD samples performed?' is Yes, but Not Done for all Planned Time Point are checked. Please confirm and update as appropriate.";nn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.CodedValue().ToString() == "Y")n {n DataPoints dpTargets = CustomFunction.FetchAllDataPointsForOIDPath("PCSTAT", currentDatapage, currentInstance, currentSubject);n if (dpTargets.Count > 0)n {n foreach (DataPoint dpTarget in dpTargets)n {n if (dpTarget != null && dpTarget.Active && dpTarget.Data == string.Empty)n {n openQuery = false;n break;n }n }n }n }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, openQuery, afp.CheckID, afp.CheckHash);n return null;

13


//Description: Corresponding AE ID is inactivated in Adverse Event form, but it is still selected in this question.nn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n bool OpenQuery = false;n string queryText = "Corresponding AE ID is inactivated in Adverse Event form, but it is still selected in this question. Please check and update as appropriate.";nn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant)n {n System.Collections.Generic.List<string> Lists = new System.Collections.Generic.List<string>();nn DataPoints dpIDs = CustomFunction.FetchAllDataPointsForOIDPath("AESPID", "AE01", "AE", dpInput.Record.Subject);n foreach (DataPoint dpID in dpIDs)n {n if (dpID.Active && dpID.Data != string.Empty)n Lists.Add(dpID.Data.ToString());n }nn if (Lists.Contains(dpInput.Data.ToString()) == false)n OpenQuery = true;nn }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;nCSharpt nCF_EC_PE02_1014

14

//Description: Corresponding MH ID is inactivated in General Medical History form, but it is still selected in this question.nn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n bool OpenQuery = false;n string queryText = "Corresponding MH ID is inactivated in General Medical History form, but it is still selected in this question. Please check and update as appropriate.";nn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant)n {n System.Collections.Generic.List<string> Lists = new System.Collections.Generic.List<string>();nn DataPoints dpMHIDs = CustomFunction.FetchAllDataPointsForOIDPath("MHID", "MH01", "SCREEN", dpInput.Record.Subject);n foreach (DataPoint dpMHID in dpMHIDs)n {n if (dpMHID.Active && dpMHID.Data != string.Empty)n Lists.Add(dpMHID.Data.ToString());n }nn if (Lists.Contains(dpInput.Data.ToString()) == false)n OpenQuery = true;nn }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;

15

//Short Description: 'Visit Date: ' in CnD1 is not 21 days after C(n-1)D1.;'Visit Date: ' in CnD8 is not 7 days after CnD1.n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n bool OpenQuery1 = false;n string queryText1 = "'Visit Date:' is not 21(± 1) days after last cycle's Day1. Please check Visit Date here and Visit Date in last cycle's Day1, update if applicable. Otherwise, specify.";n bool OpenQuery2 = false;n string queryText2 = "'Visit Date:' is not 7(± 1) days after this cycle's Day1. Please check Visit Date here and Visit Date in this cycle's Day1, update if applicable. Otherwise, specify.";nn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant && dpInput.MissingCode == null && dpInput.StandardValue() is DateTime)n {n Instance currentInstance = dpInput.Record.Instance;n if (currentInstance.Folder.OID == "C" && currentInstance.InstanceRepeatNumber == 0)n {n Instance preInstance = dpInput.Record.Subject.Instances.FindByFolderOID("C4D1");n if (preInstance != null && preInstance.Active)n {n DataPage dpgPreForm = preInstance.DataPages.FindByFormOID("SV01");n DataPoint dpPreDat = dpgPreForm.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n if (dpPreDat != null && dpPreDat.Active && dpPreDat.Data != string.Empty && dpPreDat.EntryStatus != EntryStatusEnum.NonConformant && dpPreDat.MissingCode == null && dpPreDat.StandardValue() is DateTime)n {n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpPreviousDate = (DateTime) dpPreDat.StandardValue();n if (dpCurrentDate.CompareTo(dpPreviousDate.AddDays(20)) < 0 || dpCurrentDate.CompareTo(dpPreviousDate.AddDays(22)) > 0)n OpenQuery1 = true;n }n }n }nn if (currentInstance.Folder.OID == "C" && currentInstance.InstanceRepeatNumber != 0)n {n double currentCycle = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(currentInstance.Name.Substring(0, currentInstance.Name.IndexOf("Day")).ToString(), @"[^0-9]+", ""));n double currentDay = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(currentInstance.Name.Substring(currentInstance.Name.IndexOf("Day"), 5).ToString(), @"[^0-9]+", ""));n Instances allInstance = dpInput.Record.Subject.Instances;nn if (allInstance.Count > 0)n {n foreach (Instance preInstance in allInstance)n {n if (preInstance != null && preInstance.Active && preInstance.Folder.OID == "C" && currentInstance.InstanceRepeatNumber != preInstance.InstanceRepeatNumber)n {n double preCycle = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(preInstance.Name.Substring(0, preInstance.Name.IndexOf("Day")).ToString(), @"[^0-9]+", ""));n double preDay = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(preInstance.Name.Substring(preInstance.Name.IndexOf("Day"), 5).ToString(), @"[^0-9]+", ""));nn if (preCycle == currentCycle - 1 && preDay == currentDay)n {n DataPage dpgPreForm = preInstance.DataPages.FindByFormOID("SV01");n if (dpgPreForm != null && dpgPreForm.Active)n {n DataPoint dpPreDat = dpgPreForm.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n if (dpPreDat != null && dpPreDat.Active && dpPreDat.Data != string.Empty && dpPreDat.EntryStatus != EntryStatusEnum.NonConformant && dpPreDat.MissingCode == null && dpPreDat.StandardValue() is DateTime)n {n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpPreviousDate = (DateTime) dpPreDat.StandardValue();nn if (dpCurrentDate.CompareTo(dpPreviousDate.AddDays(20)) < 0 || dpCurrentDate.CompareTo(dpPreviousDate.AddDays(22)) > 0)n {n OpenQuery1 = true;n break;n }n }n }n }nn if (preCycle == currentCycle && preDay == currentDay - 7)n {n DataPage dpgPreForm = preInstance.DataPages.FindByFormOID("SV01");n if (dpgPreForm != null && dpgPreForm.Active)n {n DataPoint dpPreDat = dpgPreForm.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n if (dpPreDat != null && dpPreDat.Active && dpPreDat.Data != string.Empty && dpPreDat.EntryStatus != EntryStatusEnum.NonConformant && dpPreDat.MissingCode == null && dpPreDat.StandardValue() is DateTime)n {n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpPreviousDate = (DateTime) dpPreDat.StandardValue();n if (dpCurrentDate.CompareTo(dpPreviousDate.AddDays(6)) < 0 || dpCurrentDate.CompareTo(dpPreviousDate.AddDays(8)) > 0)n {n OpenQuery2 = true;n break;n }n }n }n }n }n }n }n }n }n CustomFunction.PerformQueryAction(queryText1, 1, false, false, dpInput, OpenQuery1, afp.CheckID, afp.CheckHash);n CustomFunction.PerformQueryAction(queryText2, 1, false, false, dpInput, OpenQuery2, afp.CheckID, afp.CheckHash);n return null;

16

//Short Description: 'Visit Date: ' in CnD1 is not 21 days after C(n-1)D1.;'Visit Date: ' in CnD8 is not 21 days after CnD1.n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n Subject subj = dpInput.Record.Subject;n bool OpenQuery = false;n bool OpenQuery1 = false;n bool NextPageExist = false;n string queryText1 = "'Visit Date:' is not 21(± 1) days after last cycle's Day1. Please check Visit Date here and Visit Date in last cycle's Day1, update if applicable. Otherwise, specify.";nnn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant && dpInput.MissingCode == null && dpInput.StandardValue() is DateTime)n {n Instance currentInstance = dpInput.Record.Instance;nnn if (currentInstance.Folder.OID == "C" && currentInstance.InstanceRepeatNumber != 0 && currentInstance.InstanceRepeatNumber % 2 == 0)n {n //double currentCycle = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(currentInstance.Name.Substring(0, currentInstance.Name.IndexOf("Day")).ToString(), @"[^0-9]+", ""));n //double currentDay = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(currentInstance.Name.Substring(currentInstance.Name.IndexOf("Day"), 5).ToString(), @"[^0-9]+", ""));n Instances allInstance = dpInput.Record.Subject.Instances;nn //compare current CND1 visit date with CN-1D1 visit daten if (allInstance.Count > 0)n {n foreach (Instance XInstance in allInstance)n {n if (XInstance != null && XInstance.Active && XInstance.Folder.OID == "C" && XInstance.InstanceRepeatNumber == currentInstance.InstanceRepeatNumber - 2)n {n //double preCycle = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(preInstance.Name.Substring(0, preInstance.Name.IndexOf("Day")).ToString(), @"[^0-9]+", ""));n //double preDay = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(preInstance.Name.Substring(preInstance.Name.IndexOf("Day"), 5).ToString(), @"[^0-9]+", ""));nn //if (preCycle == currentCycle - 1 && preDay == currentDay)nn DataPage dpgPreForm = XInstance.DataPages.FindByFormOID("SV01");n if (dpgPreForm != null && dpgPreForm.Active)n {nn DataPoint dpPreDat = dpgPreForm.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n if (dpPreDat != null && dpPreDat.Active && dpPreDat.Data != string.Empty && dpPreDat.EntryStatus != EntryStatusEnum.NonConformant && dpPreDat.MissingCode == null && dpPreDat.StandardValue() is DateTime)n {n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpPreviousDate = (DateTime) dpPreDat.StandardValue();nn if (dpCurrentDate.CompareTo(dpPreviousDate.AddDays(20)) < 0 || dpCurrentDate.CompareTo(dpPreviousDate.AddDays(22)) > 0)n {n OpenQuery = true;n break;n }n }n }nn }nn }n }n CustomFunction.PerformQueryAction(queryText1, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);nnn //compare current CND1 visit date with CN+1D1 visit daten //find if next visit meet the timeslot.n if (allInstance.Count > 0)n {n foreach (Instance XInstance in allInstance)n {n if (XInstance != null && XInstance.Active && XInstance.Folder.OID == "C" && XInstance.InstanceRepeatNumber == currentInstance.InstanceRepeatNumber + 2)n {n DataPage dpgNextForm = XInstance.DataPages.FindByFormOID("SV01");n if (dpgNextForm != null && dpgNextForm.Active)n {n NextPageExist = true;n DataPoint dpNextDat = dpgNextForm.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n if (dpNextDat != null && dpNextDat.Active && dpNextDat.Data != string.Empty && dpNextDat.EntryStatus != EntryStatusEnum.NonConformant && dpNextDat.MissingCode == null && dpNextDat.StandardValue() is DateTime)n {n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpNextDate = (DateTime) dpNextDat.StandardValue();nn if (dpNextDate.CompareTo(dpCurrentDate.AddDays(20)) < 0 || dpNextDate.CompareTo(dpCurrentDate.AddDays(22)) > 0)n {n OpenQuery1 = true;n break;n }n }nn }n }n }n }n //open/close qury in next visit.n if (allInstance.Count > 0 && NextPageExist)n {n foreach (Instance XInstance in allInstance)n {n if (XInstance.InstanceRepeatNumber == currentInstance.InstanceRepeatNumber + 2)n {n DataPage dpgNextForm = XInstance.DataPages.FindByFormOID("SV01");n DataPoint dpNextDat = dpgNextForm.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n CustomFunction.PerformQueryAction(queryText1, 1, false, false, dpNextDat, OpenQuery1, afp.CheckID, afp.CheckHash);n break;n }n }n }n }n }n return null;

17

//Description: min'Start Date' on "Study Drug Administration" page in C1D1- Scan Date >28 days or min'Start Date' on "Study Drug Administration" page in C1D1 < Scan Datenn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n bool OpenQuery = false;n string queryText = "'Screening target lesion is not performed within time window(<=28 days prior to the first dose date). Please check these two tests and update if applicable. Otherwise, specify.";nn DateTime Mindate = DateTime.MaxValue;n if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant && dpInput.MissingCode == null && dpInput.StandardValue() is DateTime)n {n DataPoints dpMinDat = CustomFunction.FetchAllDataPointsForOIDPath("ECSTDAT", "EC01", "C1D1", dpInput.Record.Subject);n if (dpMinDat.Count > 0)n {n for (int i = 0; i < dpMinDat.Count; i++)n {n if (dpMinDat[i] != null && dpMinDat[i].Active && dpMinDat[i].Data != string.Empty)n {n DateTime dtTarget = (DateTime) dpMinDat[i].StandardValue();n if (Mindate > dtTarget)n Mindate = dtTarget;n }n }nn DateTime dpTarget = (DateTime) dpInput.StandardValue();n if (Mindate.CompareTo(dpTarget.AddDays(28)) > 0 || Mindate.CompareTo(dpTarget) < 0)n OpenQuery = true;n }n }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;

18

//Description: min'Start Date' on "Study Drug Administration" page in C1D1- Scan Date >28 days or min'Start Date' on "Study Drug Administration" page in C1D1 < Scan Datenn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n bool OpenQuery = false;n string queryText = "'Screening non-target lesion is not performed within time window(<=28 days prior to the first dose date). Please check these two tests and update if applicable. Otherwise, specify.";nn DateTime Mindate = DateTime.MaxValue;n if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant && dpInput.MissingCode == null && dpInput.StandardValue() is DateTime)n {n DataPoints dpMinDat = CustomFunction.FetchAllDataPointsForOIDPath("ECSTDAT", "EC01", "C1D1", dpInput.Record.Subject);n if (dpMinDat.Count > 0)n {n for (int i = 0; i < dpMinDat.Count; i++)n {n if (dpMinDat[i] != null && dpMinDat[i].Active && dpMinDat[i].Data != string.Empty)n {n DateTime dtTarget = (DateTime) dpMinDat[i].StandardValue();n if (Mindate > dtTarget)n Mindate = dtTarget;n }n }nn DateTime dpTarget = (DateTime) dpInput.StandardValue();n if (Mindate.CompareTo(dpTarget.AddDays(28)) > 0 || Mindate.CompareTo(dpTarget) < 0)n OpenQuery = true;n }n }n CustomFunction.PerformQueryAction(queryText, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;

11

//Description: min date (CheckStep)nn DataPoint dpStep = (DataPoint) ThisObject;nn DateTime Mindate = DateTime.MaxValue;n DateTime sysMindate = DateTime.MaxValue;n string field = dpStep.Field.OID.ToString();n //Records dpRecord = dpStep.Record.DataPage.Records;nn DataPoints dpTargets = CustomFunction.FetchAllDataPointsForOIDPath(field, dpStep.Record.DataPage.Form.OID, dpStep.Record.Instance.Folder.OID, dpStep.Record.Subject);nn foreach (DataPoint dpTarget in dpTargets)n {n if (dpTarget != null && dpTarget.Active && dpTarget.Data != string.Empty)n {n DateTime dtTarget = (DateTime) dpTarget.StandardValue();n if (Mindate > dtTarget)n Mindate = dtTarget;n }n }n /* if (dpRecord.Count > 0)n {n for (int i = 0; i < dpRecord.Count; i++)n {n if (dpRecord[i] != null && dpRecord[i].Active && dpRecord[i].RecordPosition != 0)n {n DataPoint dpTarget = dpRecord[i].DataPoints.FindByFieldOID(field);n if (dpTarget != null && dpTarget.Active && dpTarget.Data != string.Empty)n {n DateTime dtTarget = (DateTime)dpTarget.StandardValue();n if (Mindate > dtTarget)n Mindate = dtTarget;n }n }n }n }*/nn if (Mindate.CompareTo(sysMindate) <0)n return true;nn return false;n11

11

//Short Description: 'Visit Date: ' in CnD1 is not 21 days after C(n-1)D1.;'Visit Date: ' in CnD8 is not 7 days after CnD1.n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n Subject subj = dpInput.Record.Subject;n bool OpenQuery = false;n bool OpenQuery1 = false;n bool NextPageExist = false;n string queryText1 = "'Visit Date:' is not 21(± 1) days after last cycle's Day1. Please check Visit Date here and Visit Date in last cycle's Day1, update if applicable. Otherwise, specify.";nnn if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant && dpInput.MissingCode == null && dpInput.StandardValue() is DateTime)n {n Instance currentInstance = dpInput.Record.Instance;nnn if (currentInstance.Folder.OID == "C" && currentInstance.InstanceRepeatNumber != 0 && currentInstance.InstanceRepeatNumber % 2 == 0)n {n //double currentCycle = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(currentInstance.Name.Substring(0, currentInstance.Name.IndexOf("Day")).ToString(), @"[^0-9]+", ""));n //double currentDay = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(currentInstance.Name.Substring(currentInstance.Name.IndexOf("Day"), 5).ToString(), @"[^0-9]+", ""));n Instances allInstance = dpInput.Record.Subject.Instances;nn //compare current CND1 visit date with CN-1D1 visit daten if (allInstance.Count > 0)n {n foreach (Instance XInstance in allInstance)n {n if (XInstance != null && XInstance.Active && XInstance.Folder.OID == "C" && XInstance.InstanceRepeatNumber == currentInstance.InstanceRepeatNumber - 2)n {n //double preCycle = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(preInstance.Name.Substring(0, preInstance.Name.IndexOf("Day")).ToString(), @"[^0-9]+", ""));n //double preDay = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(preInstance.Name.Substring(preInstance.Name.IndexOf("Day"), 5).ToString(), @"[^0-9]+", ""));nn //if (preCycle == currentCycle - 1 && preDay == currentDay)nn DataPage dpgPreForm = XInstance.DataPages.FindByFormOID("SV01");n if (dpgPreForm != null && dpgPreForm.Active)n {nn DataPoint dpPreDat = dpgPreForm.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n if (dpPreDat != null && dpPreDat.Active && dpPreDat.Data != string.Empty && dpPreDat.EntryStatus != EntryStatusEnum.NonConformant && dpPreDat.MissingCode == null && dpPreDat.StandardValue() is DateTime)n {n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpPreviousDate = (DateTime) dpPreDat.StandardValue();nn if (dpCurrentDate.CompareTo(dpPreviousDate.AddDays(20)) < 0 || dpCurrentDate.CompareTo(dpPreviousDate.AddDays(22)) > 0)n {n OpenQuery = true;n break;n }n }n }nn }nn }n }n CustomFunction.PerformQueryAction(queryText1, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);nnn //compare current CND1 visit date with CN+1D1 visit daten //find if next visit meet the timeslot.n if (allInstance.Count > 0)n {n foreach (Instance XInstance in allInstance)n {n if (XInstance != null && XInstance.Active && XInstance.Folder.OID == "C" && XInstance.InstanceRepeatNumber == currentInstance.InstanceRepeatNumber + 2)n {n DataPage dpgNextForm = XInstance.DataPages.FindByFormOID("SV01");n if (dpgNextForm != null && dpgNextForm.Active)n {n NextPageExist = true;n DataPoint dpNextDat = dpgNextForm.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n if (dpNextDat != null && dpNextDat.Active && dpNextDat.Data != string.Empty && dpNextDat.EntryStatus != EntryStatusEnum.NonConformant && dpNextDat.MissingCode == null && dpNextDat.StandardValue() is DateTime)n {n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpNextDate = (DateTime) dpNextDat.StandardValue();nn if (dpNextDate.CompareTo(dpCurrentDate.AddDays(20)) < 0 || dpNextDate.CompareTo(dpCurrentDate.AddDays(22)) > 0)n {n OpenQuery1 = true;n break;n }n }nn }n }n }n }n //open/close qury in next visit.n if (allInstance.Count > 0 && NextPageExist)n {n foreach (Instance XInstance in allInstance)n {n if (XInstance.InstanceRepeatNumber == currentInstance.InstanceRepeatNumber + 2)n {n DataPage dpgNextForm = XInstance.DataPages.FindByFormOID("SV01");n DataPoint dpNextDat = dpgNextForm.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n CustomFunction.PerformQueryAction(queryText1, 1, false, false, dpNextDat, OpenQuery1, afp.CheckID, afp.CheckHash);n break;n }n }n }n }n }n return null;nCSharpt n t提交 Add Custom Function

11

//Short Description: derive values from (SCREEN - TU01) to TU03n //Modification History: Creatednn DataPoint TDP = ((ActionFunctionParams) ThisObject).ActionDataPoint;n Subject ThisSubject = TDP.Record.Subject;n Instance TIST = TDP.Record.DataPage.Instance;n string formOID1 = "TA02";n string formOID2 = "TA04";n string formOID3 = "TA05";n string formOID4 = "RS01";nn DataPage dp1 = TIST.DataPages.FindByFormOID(formOID1);n DataPage dp2 = TIST.DataPages.FindByFormOID(formOID2);n DataPage dp3 = TIST.DataPages.FindByFormOID(formOID3);n DataPage dp4 = TIST.DataPages.FindByFormOID(formOID4);nnnn if (TDP != null && TDP.Active && TDP.Data != "N")n {n if (dp1 != null) dp1.Active = true;n if (dp2 != null) dp2.Active = true;n if (dp3 != null) dp3.Active = true;n if (dp4 != null) dp4.Active = true;n }n elsen {n if (dp1 != null) dp1.Active = false;n if (dp2 != null) dp2.Active = false;n if (dp3 != null) dp3.Active = false;n if (dp4 != null) dp4.Active = false;n }n return null;

11

//Short Description: Add repeat folder C after C5D1 and rename it as CnD1(n=6,7...), when SVCONT is Yes in Cn-1D1.n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint input_DP = afp.ActionDataPoint;nn Subject subj = input_DP.Record.Subject;n Instance current_ins = input_DP.Record.DataPage.Instance;n string current_OID = current_ins.Folder.OID;n int currRepeatNo = current_ins.InstanceRepeatNumber;n const int intStringKey_CycleText = 53479;n string strCycleText = Localization.GetLocalDataString(intStringKey_CycleText);n // enter the project specific info heren string NextcycleY = "Y";n string NextcycleN = "N";n string firstTrigger_OID = "C5D1";n int firstRptNo = 6;n string rptCycle_OID = "C";n string matrix_OID = "C";nn // do nothing when the folder is not what we needn if (current_OID != firstTrigger_OID && current_OID != rptCycle_OID)n return null;nn // calculate the total number of repeat cyclesn Instances all_ins = subj.Instances;n Instances Cycles = new Instances();n int count = 0;n for (int i = 0; i < all_ins.Count; i++)n {n if (all_ins[i].Folder.OID == rptCycle_OID)n {n Cycles.Add(all_ins[i]);n count++;n }n }n // Add matrix only when input_DP is yes and avoid generating unexpected cycle when input_DP is ticked YES then NO then YES and so onn if (input_DP.Data == NextcycleY && input_DP.IsObjectChanged && (current_OID == firstTrigger_OID && currRepeatNo > (count - 1) || current_OID == rptCycle_OID && currRepeatNo >= (count - 1) /*&& currRepeatNo <= 13*/))n {n Matrix cycle = Matrix.FetchByOID(matrix_OID, subj.CRFVersionID);n subj.AddMatrix(cycle);nn // give the proper folder name according to folder repeat number, it will be like Cycle n, Cycle n+1, Cylce n+2 and etc.n int cycle_num;n cycle_num = (current_ins.Folder.OID == firstTrigger_OID) ? firstRptNo : firstRptNo + (current_ins.InstanceRepeatNumber + 1);nn for (int i = 0; i < all_ins.Count; i++)n {n if (all_ins[i].Folder.OID == rptCycle_OID)n {n // set instance name, the instance is added from the first trigger folder (repeat number = 0)n if (current_ins.Folder.OID == firstTrigger_OID && all_ins[i].InstanceRepeatNumber == 0)n {n all_ins[i].SetInstanceName(firstRptNo.ToString() /*.PadLeft(2, '0')*/ + " " + strCycleText);n break;n }n // set instance name, the instance is added from repeat folder (repeat number = 1, 2, 3...)n else if (all_ins[i].InstanceRepeatNumber == current_ins.InstanceRepeatNumber + 1)n {n all_ins[i].SetInstanceName(cycle_num.ToString() /*.PadLeft(2, '0')*/ + " " + strCycleText);n break;n }n }n }n }n // inactivate folders when selecting NO in the last fixed visit, which is the first trigger foldern if (input_DP.Data == NextcycleN && current_OID == firstTrigger_OID && count == 1 && Cycles[0].EntryStatus == EntryStatusEnum.NoData)n Cycles[0].Active = false;n else if (input_DP.Data == NextcycleY && current_OID == firstTrigger_OID && count == 1 && Cycles[0].Active == false)n Cycles[0].Active = true;nn // inactivate folders when selecting NO in the "CYCLE" folder before the last "CYCLE" folder, which are repet cycle foldersn if (input_DP.Data == NextcycleN && count > 1 && current_ins == Cycles[count - 2] && Cycles[count - 1].EntryStatus == EntryStatusEnum.NoData)n Cycles[count - 1].Active = false;n else if (input_DP.Data == NextcycleY && count > 1 && current_ins == Cycles[count - 2] && Cycles[count - 1].Active == false)n Cycles[count - 1].Active = true;nn return null;

11

//Short Description: Add repeat folder C after C5D1 and rename it as CnD1(n=6,7...), when SVCONT is Yes in Cn-1D1.n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint input_DP = afp.ActionDataPoint;nn Subject subj = input_DP.Record.Subject;n Instance current_ins = input_DP.Record.DataPage.Instance;n string current_OID = current_ins.Folder.OID;n int currRepeatNo = current_ins.InstanceRepeatNumber;n const int intStringKey_CycleText = 53492;n string strCycleText = Localization.GetLocalDataString(intStringKey_CycleText);n // enter the project specific info heren string NextcycleY = "Y";n string NextcycleN = "N";n string firstTrigger_OID = "TA_W6";n int firstRptNo = 12;n string rptCycle_OID = "TA";n string matrix_OID = "TA";nn // do nothing when the folder is not what we needn if (current_OID != firstTrigger_OID && current_OID != rptCycle_OID)n return null;nn // calculate the total number of repeat cyclesn Instances all_ins = subj.Instances;n Instances Cycles = new Instances();n int count = 0;n for (int i = 0; i < all_ins.Count; i++)n {n if (all_ins[i].Folder.OID == rptCycle_OID)n {n Cycles.Add(all_ins[i]);n count++;n }n }n // Add matrix only when input_DP is yes and avoid generating unexpected cycle when input_DP is ticked YES then NO then YES and so onn if (input_DP.Data == NextcycleY && input_DP.IsObjectChanged && (current_OID == firstTrigger_OID && currRepeatNo > (count - 1) || current_OID == rptCycle_OID && currRepeatNo >= (count - 1) /*&& currRepeatNo <= 13*/))n {n Matrix cycle = Matrix.FetchByOID(matrix_OID, subj.CRFVersionID);n subj.AddMatrix(cycle);nn // give the proper folder name according to folder repeat number, it will be like Cycle n, Cycle n+1, Cylce n+2 and etc.n int cycle_num;n cycle_num = (current_ins.Folder.OID == firstTrigger_OID) ? firstRptNo : (current_ins.InstanceRepeatNumber+1);nn for (int i = 0; i < all_ins.Count; i++)n {n if (all_ins[i].Folder.OID == rptCycle_OID)n {n // set instance name, the instance is added from the first trigger folder (repeat number = 0)n if (current_ins.Folder.OID == firstTrigger_OID && all_ins[i].InstanceRepeatNumber == 0)n {n all_ins[i].SetInstanceName(firstRptNo.ToString() + " " + strCycleText);n break;n }n // set instance name, the instance is added from repeat folder (repeat number = 1, 2, 3...)n else if (all_ins[i].InstanceRepeatNumber == current_ins.InstanceRepeatNumber + 1)n {n if(current_ins.InstanceRepeatNumber <6)n {n all_ins[i].SetInstanceName((cycle_num * 6 + 12).ToString() + " " + strCycleText);n break;n }n if (current_ins.InstanceRepeatNumber == 6 || current_ins.InstanceRepeatNumber > 6)n {n all_ins[i].SetInstanceName(((cycle_num - 6) * 12 + 48).ToString() + " " + strCycleText);n break;n }nn }n }n }n }n // inactivate folders when selecting NO in the last fixed visit, which is the first trigger foldern if (input_DP.Data == NextcycleN && current_OID == firstTrigger_OID && count == 1 && Cycles[0].EntryStatus == EntryStatusEnum.NoData)n Cycles[0].Active = false;n else if (input_DP.Data == NextcycleY && current_OID == firstTrigger_OID && count == 1 && Cycles[0].Active == false)n Cycles[0].Active = true;nn // inactivate folders when selecting NO in the "CYCLE" folder before the last "CYCLE" folder, which are repet cycle foldersn if (input_DP.Data == NextcycleN && count > 1 && current_ins == Cycles[count - 2] && Cycles[count - 1].EntryStatus == EntryStatusEnum.NoData)n Cycles[count - 1].Active = false;n else if (input_DP.Data == NextcycleY && count > 1 && current_ins == Cycles[count - 2] && Cycles[count - 1].Active == false)n Cycles[count - 1].Active = true;nn return null;

11

//Description: Add Repeat Form and Update the Form Name(SCREEN_CM03)nn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpAct = afp.ActionDataPoint;n Subject currentSubject = dpAct.Record.Subject;n DataPage currentDatapage = dpAct.Record.DataPage;nn int currentPageRepeatNo = dpAct.Record.DataPage.PageRepeatNumber;n int maxRepeatNo = 0;nn int currentNo = dpAct.Record.DataPage.PageRepeatNumber + 1;n int nextNo = dpAct.Record.DataPage.PageRepeatNumber + 2;nn if (dpAct != null && dpAct.Active)n {n if (dpAct.Data != string.Empty && dpAct.CodedValue().ToString() == "Y")n {n DataPages nextForms = currentDatapage.Instance.DataPages;n for (int i = 0; i < nextForms.Count; i++)n {n if (nextForms[i].Form.OID == "CM03")n {n if (nextForms[i].PageRepeatNumber > maxRepeatNo)n maxRepeatNo = nextForms[i].PageRepeatNumber;nn if (nextForms[i] != null && !nextForms[i].Active && nextForms[i].PageRepeatNumber == currentPageRepeatNo + 1)n nextForms[i].Active = true;n }n }nn Matrix targetMatrix = Matrix.FetchByOID("CM03", currentSubject.CRFVersionID);n if (currentDatapage.PageRepeatNumber == maxRepeatNo)n currentSubject.AddMatrix(targetMatrix);nn System.Collections.Generic.List<int> pageNoLists = new System.Collections.Generic.List<int>();n DataPages allDatapages = currentDatapage.Instance.DataPages;n foreach (DataPage dpg in allDatapages)n {n if (dpg != null && dpg.Active && dpg.Form.OID == "CM03")n pageNoLists.Add(allDatapages.IndexOf(dpg));n }nn if (dpAct != null && dpAct.Active && dpAct.Data != string.Empty && dpAct.CodedValue().ToString() == "Y")n {n if (pageNoLists.Count > 0)n {n for (int i = 0; i < pageNoLists.Count; i++)n {n if(allDatapages[pageNoLists[i]].PageRepeatNumber !=0)n {n if (allDatapages[pageNoLists[i]].PageRepeatNumber == currentDatapage.PageRepeatNumber)n {n string currentPageNo = currentDatapage.Form.Name + "-" + currentNo;n if (!currentDatapage.Name.Contains(currentPageNo))n currentDatapage.Name = currentPageNo;n }nn if (allDatapages[pageNoLists[i]].PageRepeatNumber == currentNo)n {n string nextPageNo = currentDatapage.Form.Name + "-" + nextNo;n if (!allDatapages[pageNoLists[i]].Name.Contains(nextPageNo))n allDatapages[pageNoLists[i]].Name = nextPageNo;n }n }n }n }n }n }n else if (dpAct.Data == string.Empty || dpAct.CodedValue().ToString() == "N")n {n foreach (DataPage nextForm in dpAct.Record.Instance.DataPages)n {n if (nextForm != null && nextForm.Active && nextForm.Form.OID == "CM03" && nextForm.PageRepeatNumber == currentPageRepeatNo + 1)n {n nextForm.Active = false;n }n }n }n }n return null;

11

//Short Description: Add repeat folder C after C5D1 and rename it as CnD1(n=6,7...), when SVCONT is Yes in Cn-1D1.n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint input_DP = afp.ActionDataPoint;nn Subject subj = input_DP.Record.Subject;n Instance current_ins = input_DP.Record.DataPage.Instance;n string current_OID = current_ins.Folder.OID;n int currRepeatNo = current_ins.InstanceRepeatNumber;n const int intStringKey_CycleText = 53492;n string strCycleText = Localization.GetLocalDataString(intStringKey_CycleText);n // enter the project specific info heren string NextcycleY = "Y";n string NextcycleN = "N";n string firstTrigger_OID = "TA_W6";n int firstRptNo = 12;n string rptCycle_OID = "TA";n string matrix_OID = "TA";nn // do nothing when the folder is not what we needn if (current_OID != firstTrigger_OID && current_OID != rptCycle_OID)n return null;nn // calculate the total number of repeat cyclesn Instances all_ins = subj.Instances;n Instances Cycles = new Instances();n int count = 0;n for (int i = 0; i < all_ins.Count; i++)n {n if (all_ins[i].Folder.OID == rptCycle_OID)n {n Cycles.Add(all_ins[i]);n count++;n }n }n // Add matrix only when input_DP is yes and avoid generating unexpected cycle when input_DP is ticked YES then NO then YES and so onn if (input_DP.Data == NextcycleY && input_DP.IsObjectChanged && (current_OID == firstTrigger_OID && currRepeatNo > (count - 1) || current_OID == rptCycle_OID && currRepeatNo >= (count - 1) /*&& currRepeatNo <= 13*/))n {n Matrix cycle = Matrix.FetchByOID(matrix_OID, subj.CRFVersionID);n subj.AddMatrix(cycle);nn // give the proper folder name according to folder repeat number, it will be like Cycle n, Cycle n+1, Cylce n+2 and etc.n int cycle_num;n cycle_num = (current_ins.Folder.OID == firstTrigger_OID) ? firstRptNo : (current_ins.InstanceRepeatNumber+1);nn for (int i = 0; i < all_ins.Count; i++)n {n if (all_ins[i].Folder.OID == rptCycle_OID)n {n // set instance name, the instance is added from the first trigger folder (repeat number = 0)n if (current_ins.Folder.OID == firstTrigger_OID && all_ins[i].InstanceRepeatNumber == 0)n {n all_ins[i].SetInstanceName(firstRptNo.ToString() + " " + strCycleText);n break;n }n // set instance name, the instance is added from repeat folder (repeat number = 1, 2, 3...)n else if (all_ins[i].InstanceRepeatNumber == current_ins.InstanceRepeatNumber + 1)n {n if(current_ins.InstanceRepeatNumber <6)n {n all_ins[i].SetInstanceName((cycle_num * 6 + 12).ToString() + " " + strCycleText);n break;n }n if (current_ins.InstanceRepeatNumber == 6 || current_ins.InstanceRepeatNumber > 6)n {n all_ins[i].SetInstanceName(((cycle_num - 6) * 12 + 48).ToString() + " " + strCycleText);n break;n }nn }n }n }n }n // inactivate folders when selecting NO in the last fixed visit, which is the first trigger foldern if (input_DP.Data == NextcycleN && current_OID == firstTrigger_OID && count == 1 && Cycles[0].EntryStatus == EntryStatusEnum.NoData)n Cycles[0].Active = false;n else if (input_DP.Data == NextcycleY && current_OID == firstTrigger_OID && count == 1 && Cycles[0].Active == false)n Cycles[0].Active = true;nn // inactivate folders when selecting NO in the "CYCLE" folder before the last "CYCLE" folder, which are repet cycle foldersn if (input_DP.Data == NextcycleN && count > 1 && current_ins == Cycles[count - 2] && Cycles[count - 1].EntryStatus == EntryStatusEnum.NoData)n Cycles[count - 1].Active = false;n else if (input_DP.Data == NextcycleY && count > 1 && current_ins == Cycles[count - 2] && Cycles[count - 1].Active == false)n Cycles[count - 1].Active = true;nn return null;n

11

//Short Description: Add additional current form, when add page field is Yes on the current form.n //Modification History: Creatednn //General Variablesn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint adp = afp.ActionDataPoint;n Subject subj = adp.Record.Subject;n Instance ins = adp.Record.DataPage.Instance;n DataPages PGs = (ins == null) ? subj.DataPages : ins.DataPages;nn string currForm_OID = adp.Record.DataPage.Form.OID;n int currPageRptNo = adp.Record.DataPage.PageRepeatNumber;n string AddFormY = "Y";nn if (currPageRptNo == 0 && adp.IsObjectChanged && adp.Record.DataPage.Name.IndexOf("1") == -1)n {n adp.Record.DataPage.Name = adp.Record.DataPage.Name + "1";n }nn //add form when AddFormY is Yes(4)n if (adp.Data == AddFormY)n {n //put all form repeat number in the list arraylistn ArrayList list = new ArrayList();n foreach (DataPage pg in PGs)nn if (pg.Form.OID == currForm_OID)n {n int pgRpt = pg.PageRepeatNumber;n list.Add(pgRpt);n }n // add form only when there is no page repeat number is greater than the current one and rename the page name per repeat numbern if (!list.Contains(currPageRptNo + 1))n {n DataPage newAdd_PG = AddForm(adp);n newAdd_PG.Name = newAdd_PG.Form.Name + "" + (currPageRptNo + 2);nn }n // activate pages when their page repeat numbers are greater than the current onenn elsen {n foreach (DataPage pg in PGs)n {n if (pg.PageRepeatNumber == currPageRptNo + 1)n pg.Active = true;n }n }nn }nn //when AddFormY is not Yes(4), inactivate forms when their form repeat numbers are greater than the current onen elsen {n foreach (DataPage pg in PGs)n {n if (pg.Active && pg.Form.OID == currForm_OID && pg.PageRepeatNumber == currPageRptNo + 1 && pg.EntryStatus == EntryStatusEnum.NoData)n pg.Active = false;n }nn }n return null;n }nn DataPage AddForm(DataPoint adp)n {n string form_OID = adp.Record.Form.OID;n Subject subj = adp.Record.Subject;n Instance ins = adp.Record.DataPage.Instance;n // if the form is under subject level, then container will be subj, otehrwise it will be insn //IDataContainer ctnr = (ins == null) ? (IDataContainer)subj : ins;n Form newForm = Form.FetchByOID(form_OID, subj.CRFVersion.ID);n DataPage newPage = new DataPage(ins, newForm, adp.Record.SubjectMatrixID);n ins.DataPages.Add(newPage);n return newPage;

11


//Short Description: 'Visit Date: ' in CnD1 is not 21 days after C(n-1)D1.;'Visit Date: ' in CnD8 is not 21 days after CnD1.n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n Subject subj = dpInput.Record.Subject;n bool OpenQuery = false;n bool OpenQuery1 = false;n bool NextPageExist = false;n int Query_Cycle = 0;n int Query_Day = 0;n string Query_CycleNumber = string.Empty;n string Query_DayNumber = string.Empty;n const int intStringKey_QueryText1 = 56042;n string strQueryText1 = Localization.GetLocalDataString(intStringKey_QueryText1);n const int intStringKey_QueryText2 = 56057;n string strQueryText2 = Localization.GetLocalDataString(intStringKey_QueryText2);n const int intStringKey_QueryText3 = 56024;n string strQueryText3 = Localization.GetLocalDataString(intStringKey_QueryText3);n //string queryText1 = "'Visit Date:' is not 21(± 1) days after XXXXXX";n DataPage C1D1_SV = subj.Instances.FindByFolderOID("C1D1").DataPages.FindByFormOID("SV02");n if (C1D1_SV != null && C1D1_SV.Active)n {n DataPoint C1D1_SVDAT = C1D1_SV.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n if (C1D1_SVDAT != null && C1D1_SVDAT.Active && C1D1_SVDAT.EntryStatus != EntryStatusEnum.NonConformant && C1D1_SVDAT.MissingCode == null && C1D1_SVDAT.StandardValue() is DateTime)n {n if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant && dpInput.MissingCode == null && dpInput.StandardValue() is DateTime)n {n Instance currentInstance = dpInput.Record.Instance;n int Cycle_RepeatNumber = currentInstance.InstanceRepeatNumber;n Query_Cycle = Cycle_RepeatNumber + 6;n Query_Day = (Query_Cycle - 1) * 21;n Query_CycleNumber = Convert.ToString(Query_Cycle);n Query_DayNumber = Convert.ToString(Query_Day);nn if (currentInstance.Folder.OID == "C" /*&& currentInstance.InstanceRepeatNumber != 0 && currentInstance.InstanceRepeatNumber % 6 == 0*/)n {n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpC1D1tDate = (DateTime) C1D1_SVDAT.StandardValue();nn if (dpCurrentDate.CompareTo(dpC1D1tDate.AddDays(Query_Day - 2)) < 0 || dpCurrentDate.CompareTo(dpC1D1tDate.AddDays(Query_Day + 2)) > 0)n {n OpenQuery = true;n }n }n }n }n }n CustomFunction.PerformQueryAction(strQueryText1 + Query_CycleNumber + " " + strQueryText2 + Query_DayNumber + strQueryText3, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;

11

//Short Description: In the death page, "the main cause of death is" adverse events ", but none of the adverse events page is turned into death, please check.n //Modification History: Creatednn //General Variablesn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint input_DP = afp.ActionDataPoint;nn Subject currentSubject = input_DP.Record.Subject;nnnnn const int intStringKey_QueryText = 56171;n string strQueryText = Localization.GetLocalDataString(intStringKey_QueryText);n string form_AE = "AE01";n string folder_LOG = "LOG";n bool openQuery = true;n string AEOUT = "AEOUT";n DataPage dp_AE01 = currentSubject.Instances.FindByFolderOID(folder_LOG).DataPages.FindByFormOID(form_AE);n if ( input_DP.Data!= "ADVERSE EVENT")n openQuery = false;nnn if (input_DP.Data== "ADVERSE EVENT" && dp_AE01 == null)n return null;n if (input_DP.Data== "ADVERSE EVENT" && dp_AE01!=null)n {n Records rds = dp_AE01.Records;n if (rds.Count > 1)n {n for (int i = 1; i < rds.Count; i++)n {n if (rds[i].Active && rds[i].RecordPosition > 0)n {n string logField_1 = rds[i].DataPoints.FindByFieldOID(AEOUT).Data;nn if (logField_1 == "FATAL")n {n openQuery = false;n break;n }n }n }n }nn }n CustomFunction.PerformQueryAction(strQueryText, 1, false, false, input_DP, openQuery, afp.CheckID, afp.CheckHash);n return null;

11

//Short Description: 'Visit Date: ' in CnD1 is not 21 days after C(n-1)D1.;'Visit Date: ' in CnD8 is not 21 days after CnD1.n //Modification History: Creatednn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpInput = afp.ActionDataPoint;n Subject subj = dpInput.Record.Subject;n bool OpenQuery = false;nn bool NextPageExist = false;n int Query_Week = 0;nn int Query_Day = 0;n string Query_WeekNumber = string.Empty;nnn const int intStringKey_QueryText1 = 56042;n string strQueryText1 = Localization.GetLocalDataString(intStringKey_QueryText1);n const int intStringKey_QueryText2 = 56045;n string strQueryText2 = Localization.GetLocalDataString(intStringKey_QueryText2);n const int intStringKey_QueryText3 = 56044;n string strQueryText3 = Localization.GetLocalDataString(intStringKey_QueryText3);n //string queryText1 = "'Visit Date:' is not 21(± 1) days after XXXXXX";nn DataPage C1D1_SV = subj.Instances.FindByFolderOID("C1D1").DataPages.FindByFormOID("SV02");nn if (C1D1_SV != null && C1D1_SV.Active)n {n DataPoint C1D1_SVDAT = C1D1_SV.MasterRecord.DataPoints.FindByFieldOID("SVDAT");n if (C1D1_SVDAT != null && C1D1_SVDAT.Active && C1D1_SVDAT.EntryStatus != EntryStatusEnum.NonConformant && C1D1_SVDAT.MissingCode == null && C1D1_SVDAT.StandardValue() is DateTime)n {n if (dpInput != null && dpInput.Active && dpInput.Data != string.Empty && dpInput.EntryStatus != EntryStatusEnum.NonConformant && dpInput.MissingCode == null && dpInput.StandardValue() is DateTime)n {n Instance currentInstance = dpInput.Record.Instance;n int folder_RepeatNumber = currentInstance.InstanceRepeatNumber;nn if (currentInstance.Folder.OID == "TA" && currentInstance.InstanceRepeatNumber < 7 /*&& currentInstance.InstanceRepeatNumber % 6 == 0*/)n {n Query_Week = (folder_RepeatNumber + 2) * 6;n Query_Day = Query_Week * 7;n Query_WeekNumber = Convert.ToString(Query_Week);n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpC1D1tDate = (DateTime) C1D1_SVDAT.StandardValue();nn if (dpCurrentDate.CompareTo(dpC1D1tDate.AddDays(Query_Day - 10)) < 0 || dpCurrentDate.CompareTo(dpC1D1tDate.AddDays(Query_Day + 10)) > 0)n {n OpenQuery = true;n }n }nnn else if (currentInstance.Folder.OID == "TA" && currentInstance.InstanceRepeatNumber >= 7 /*&& currentInstance.InstanceRepeatNumber % 6 == 0*/)n {n Query_Week = 48 + (folder_RepeatNumber - 6) * 12;n Query_Day = Query_Week * 7;n Query_WeekNumber = Convert.ToString(Query_Week);n DateTime dpCurrentDate = (DateTime) dpInput.StandardValue();n DateTime dpC1D1tDate = (DateTime) C1D1_SVDAT.StandardValue();nn if (dpCurrentDate.CompareTo(dpC1D1tDate.AddDays(Query_Day - 10)) < 0 || dpCurrentDate.CompareTo(dpC1D1tDate.AddDays(Query_Day + 10)) > 0)n {n OpenQuery = true;n }n }nn }n }n }n CustomFunction.PerformQueryAction(strQueryText1 + Query_WeekNumber + " "+ strQueryText2 + Query_WeekNumber + strQueryText3, 1, false, false, dpInput, OpenQuery, afp.CheckID, afp.CheckHash);n return null;

11

//Short Description: Check duplicate field in log linesn //Modification History: Creatednn const int MARKING_GROUP_ID = 1;n const bool ANSWER_ON_CHANGE = false;n const bool CLOSE_ON_CHANGE = false;n const string FIELD_OID = "TULNKID";n const int intStringKey_QueryText1 = 56201;n string strQueryText = Localization.GetLocalDataString(intStringKey_QueryText1);n //string strQueryText = "Lesion number is duplicated.Please check";nn //Get the INDIC field passed in from Raven ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n DataPoint dpIndic = afp.ActionDataPoint;nn //Get a reference to all Records on the Med History pagen Records allRecords = dpIndic.Record.DataPage.Records;nn //Order records by their record positionn allRecords = GetSortedRecords(allRecords);nn bool openQuery = false;n DataPoint i_dp = null;n //for outer loopn DataPoint j_dp = null;n //for inner loopnn for (int i = allRecords.Count - 1; i > 1; i--) //i>1 because allRecords also contains master recordn {n if (allRecords[i].Active) //Skip inactive recordsn {n i_dp = allRecords[i].DataPoints.FindByFieldOID(FIELD_OID);nn for (int j = i - 1; j > 0; j--)n {n if (allRecords[j].Active)n {n j_dp = allRecords[j].DataPoints.FindByFieldOID(FIELD_OID);n if (string.Compare(i_dp.Data, j_dp.Data, true) == 0)n {n openQuery = true;n break;n //Open query only on this current duplicate.n //For other duplicates, queries will be opened in following iterations.n }n }n }n //Open or close query as necessaryn CustomFunction.PerformQueryAction(strQueryText, MARKING_GROUP_ID, ANSWER_ON_CHANGE, CLOSE_ON_CHANGE, i_dp, openQuery, afp.CheckID, afp.CheckHash);n openQuery = false;n }n }n return null;n }nn Records GetSortedRecords(Records records)n {n //Sort Records in the collection by record position.n //This method is designed to only work with records from the same single datapage.n Record[] tmpRecords = new Record[records.Count];n for (int i = 0; i < records.Count; i++)n {n Record record = records[i];n tmpRecords[record.RecordPosition] = record;n }n //Restore and return sorted objects in the original structuren records.Clear();n //Now unSortedRecords will contain sorted records.n for (int i = 0; i < tmpRecords.Length; i++)n {n records.Add(tmpRecords[i]);n }n return records;

11

//Short Description: leading question is Yes on TA02 form,but all of the file notdone is ticked.n //Modification History: Creatednn //General Variablesn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n //TUYNn DataPoint input_DP = afp.ActionDataPoint;n //DataPoints dps = input_DP.Record.DataPoints;nnn string Yes = "Y";n //string ND = "NOT DONE";n const int intStringKey_QueryText = 55791;n string strQueryText = Localization.GetLocalDataString(intStringKey_QueryText);n bool openQuery = false;n string TRSTAT = "TRSTAT";nnn if (input_DP.Data == Yes)n {n openQuery = true;n Records rds = input_DP.Record.DataPage.Records;nn for (int i = 1; i < rds.Count; i++)n {n if (rds[i].Active && rds[i].RecordPosition>0 )n {n DataPoint logField_1 = rds[i].DataPoints.FindByFieldOID(TRSTAT);nn if (logField_1.Data == string.Empty)n {n openQuery = false;n break;n }n }n }nn }n CustomFunction.PerformQueryAction(strQueryText, 1, false, false, input_DP, openQuery, afp.CheckID, afp.CheckHash);n return null;

11

//Short Description: leading question is Yes on TA04 form,but all of the file notdone is ticked.n //Modification History: Creatednn //General Variablesn ActionFunctionParams afp = (ActionFunctionParams) ThisObject;n //TUYNn DataPoint input_DP = afp.ActionDataPoint;n //DataPoints dps = input_DP.Record.DataPoints;nnn string Yes = "Y";n //string ND = "NOT DONE";n const int intStringKey_QueryText = 55792;n string strQueryText = Localization.GetLocalDataString(intStringKey_QueryText);n bool openQuery = false;n string TRSTAT = "TUSTAT";nnn if (input_DP.Data == Yes)n {n openQuery = true;n Records rds = input_DP.Record.DataPage.Records;n if(rds.Count>1)n {n for (int i = 1; i < rds.Count; i++)n {n if (rds[i].Active && rds[i].RecordPosition>0)n {n string logField_1 = rds[i].DataPoints.FindByFieldOID(TRSTAT).Data;nn if (logField_1 == string.Empty)n {n openQuery = false;n break;n }n }n }n }nn }n CustomFunction.PerformQueryAction(strQueryText, 1, false, false, input_DP, openQuery, afp.CheckID, afp.CheckHash);n return null;

11

上一篇:第29章

下一篇:28-29

精选推荐

  • 711关东煮供应商
    711关东煮供应商

    今天给大家介绍三位,奶粉,全家、罗森这些便利店里关东煮的供应商。店里卖三四块钱一串的关东煮,在网上买不到,一块钱就搞定。首先关东

  • 健康日历|高压锅容易爆炸的4个原因
    健康日历|高压锅容易爆炸的4个原因

    来源:医药养生保健报设计:李雅琴医学审核:姜峰出品人:胡丽丽

  • 高炉
    高炉

    今天这活却是个白事,等到了时辰,那家人便准备火化,本来准备送普炉,我却心中一动,便对那家人说道:“这老人走也不要省,还是送高炉吧。”

  • 高压锅和电压力锅的区别,推荐几款点压力锅
    高压锅和电压力锅的区别,推荐几款点压

    记得之前有一次去朋友家玩,他正在用高压锅煮小米粥,是的,高压锅压小米粥,大概煮了半小时,高压锅突然爆炸了,现场惨不忍睹啊,幸好厨房里没

0