Update Lookup table dataset

S

Sumana

I tried to update a hierarchical lookup table programmatically. The Maskset
for the same is set to Characters and separated by a dot and is maximum 3
levels deep. All I am trying to do is read the lookuptable into a dataset,
add a few more rows to the same, check out the lookup table and update the
lookuptable’s dataset with the new one and checkin the lookup table.

I get the following SOAP exceptions each time I run the code:

LookupTableSortOrderMustComeAfterParentSortOrder
LookupTableSortOrderIndexInvalid


LookupTableItemDoesNotFitMask


Guid Newguid = new Guid();
Guid parentguidOld = new Guid();

for (int i = 0, j = 0; i < newArray.GetLongLength(0) - 1; i++)
{
WebSvcLookupTable.LookupTableDataSet.LookupTableTreesRow
newRow
= lutDs.LookupTableTrees.NewLookupTableTreesRow();
newRow.LT_UID = ltGuid;
Newguid = Guid.NewGuid();
newRow.LT_STRUCT_UID = Newguid;
//primary keys to all the lookup tables like masks,
structures, values
newRow.LT_VALUE_SORT_INDEX =
(byte)PSLibrary.LookupTables.SortOrder.Ascending;
newRow.LT_VALUE_TEXT = newArray[i,j].ToString();
j++;
newRow.LT_VALUE_DESC = newArray[i,j].ToString();
j++;
if (newArray[i, j].Trim() == "0")
newRow.SetLT_PARENT_STRUCT_UIDNull();
else
newRow.LT_PARENT_STRUCT_UID = parentguidOld;
//to populate parent struct UID
parentguidOld = Newguid;
j = 0;
lutDs.LookupTableTrees.AddLookupTableTreesRow(newRow);
}
bool validateOnly = false;
bool autoCheckin = false;

try
{
lookupTable.CheckOutLookupTables(lutList);
lookupTable.UpdateLookupTables(lutDs, validateOnly,
autoCheckin, language);
lookupTable.CheckInLookupTables(lutList, true);
}
catch (SoapException ex)
{
lblError.Text = ex.Message.Trim();

}
}



Attached is a sample code. Below are the screenshots of the interface.
Please advise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top