EZMA2 Attributes question
-
Wednesday, January 09, 2013 10:14 PM
Hi!
During GetImportEntries if I try to populate an attribute, that has been deselected during setup of the MA, I get an exception.
Where can I check, if the attribute has been deselected?
Thanks,
Søren
All Replies
-
Thursday, January 10, 2013 6:41 AM
I usually go with the following logic
GetImportEntriesResults importReturnInfo; List<CSEntryChange> csentries = new List<CSEntryChange>(); adapter = new OracleDataAdapter(cmd); da = new DataSet(); for (int t = 0; t < myTables.Length; t++) { adapter.Fill(da, myTables[t]); for (int i = 0; i <= da.Tables[myTables[t]].Rows.Count - 1; i++) { CSEntryChange csentry1 = CSEntryChange.Create(); csentry1.ObjectModificationType = ObjectModificationType.Add; csentry1.ObjectType = myTables[t]; for (int j = 0; j < da.Tables[myTables[t]].Columns.Count; j++) { if (csentry1.ChangedAttributeNames.Contains(da.Tables[myTables[t]].Columns[j].ColumnName)) csentry1.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(da.Tables[myTables[t]].Columns[j].ColumnName, da.Tables[myTables[t]].Rows[i].ItemArray.GetValue(j).ToString().Trim())); } } } importReturnInfo = new GetImportEntriesResults(); importReturnInfo.MoreToImport = false; importReturnInfo.CSEntries = csentries; return importReturnInfo;Here
csentry1.ChangedAttributeNames.Contains(da.Tables[myTables[t]].Columns[j].ColumnName)
Checks if the attribute is present or not.
-
Thursday, January 10, 2013 5:38 PM
You can save and use the Schema info passed in during OpenImportConnection as a reference. These only include the *enabled* types and attributes.Steve Kradel, Zetetic LLC SMS OTP for FIM | Salesforce MA for FIM
- Marked As Answer by Markus VilcinskasMicrosoft Employee, Owner Monday, January 21, 2013 3:24 PM

