//code here // EntryInfo entry = Entry.GetEntryInfo(entryId, session); FieldValueCollection fvc1 = myEntry.GetFieldValues(); // This rows is my required so that can help to count max rows object FieldRuleMakingStageValues = myEntry.GetFieldValue("Rulemaking Stage"); object[] objFieldRuleMakingStageValues = null; if (FieldRuleMakingStageValues is Array) { objFieldRuleMakingStageValues = (object[])FieldRuleMakingStageValues; } else { objFieldRuleMakingStageValues = new object[1]; objFieldRuleMakingStageValues[0] = FieldRuleMakingStageValues; } // List multivalueFieldGroupIds = new List(); // Find all multivalue field groups for this entry (usually only one is defined on a template) foreach (var fieldName in fvc1.FieldNames) { int groupId = fvc1.GetFieldGroupId(fieldName); if (groupId > 0 && !multivalueFieldGroupIds.Contains(groupId)) multivalueFieldGroupIds.Add(groupId); } // Loop over the multivalue field groups (usually only one is defined on a template) foreach (var groupId in multivalueFieldGroupIds) { List fieldGroupFields = new List(); // Find the fields in this multivalue field group foreach (var fieldName in fvc1.FieldNames) { if (fvc1.GetFieldGroupId(fieldName) != groupId) continue; // Belongs to a different field group } //checking max row int highestRow = 0; if(objFieldRuleMakingStageValues != null) { highestRow = objFieldRuleMakingStageValues.Count(); } //end of checking max row //else //{ //} //int highestRow = fvc1.GetHighestRowNum(1);// 0; //// Calculate how many rows are in the multivalue field group for this entry //foreach (var fieldName in fieldGroupFields) //{ // var rowNumbers = fvc1.GetFieldRowNumbers(fieldName); // if (rowNumbers == null) // continue; // foreach (var rowNumber in rowNumbers) // highestRow = Math.Max(highestRow, rowNumber); // // highestRow = rowNumbers.Count(); //} var valuesForAllRows = new List>(); // We now know how many rows are in the field group. Assemble the ordered list of values for each field. for (int curRow = 1; curRow <= highestRow; curRow++) { var valuesForThisRow = new Dictionary(); foreach (var fieldName in fieldGroupFields) { valuesForThisRow[fieldName] = ""; // If this field does not have a row assigned, it will be blank for this row List rowNumbers = new List(); if(highestRow == 1) { rowNumbers = fvc1.GetFieldRowNumbers(fieldName); if (rowNumbers[0].ToString() == "0") { rowNumbers.Clear(); rowNumbers.Add(1); } else { // rowNumbers - do nothing } } else { //var rowNumbers = fvc1.GetFieldRowNumbers(fieldName); rowNumbers = fvc1.GetFieldRowNumbers(fieldName); for( int k=0;k<1;k++) { if (rowNumbers[k].ToString() == "0") { // rowNumbers.Clear(); rowNumbers[k] = 1;//.Add(1); } else { // rowNumbers - do nothing } } } // Find the value for this field in this row (might not exist) for (int rowNumIdx = 0; rowNumIdx < rowNumbers.Count; rowNumIdx++) { // if (rowNumbers[rowNumIdx] != curRow) // continue; // skip value from another row var fieldValuesObj = fvc1[fieldName]; if (fieldValuesObj == null) continue; // no values for this field // Make sure we are using an array if (!(fieldValuesObj is object[])) fieldValuesObj = new object[] { fieldValuesObj }; object[] fieldValuesArray = (object[])fieldValuesObj; if (fieldValuesArray.Length > (curRow - 1)) if(!string.IsNullOrEmpty(Convert.ToString(fieldValuesArray[curRow-1]))) valuesForThisRow[fieldName] = (fieldValuesArray[curRow-1]).ToString(); else valuesForThisRow[fieldName] = ""; else valuesForThisRow[fieldName] = ""; //valuesForThisRow[fieldName] = (fieldValuesArray[rowNumIdx]).ToString(); } } valuesForAllRows.Add(valuesForThisRow); } //end of code