Hi,
I am trying to update a lookuptable through PSI using following code :
$lookupTableGuid = $svcPSProxy.ReadLookupTables($EPMTYString, 0 , 1033).LookupTables | where {$_.LT_NAME -eq $Lookuptablename} $lookuptable = $svcPSProxy.ReadLookupTablesbyUids($lookupTableGuid.LT_UID, 1 , 1033) $lookuptablerowValues = $svcPSProxy.ReadLookupTablesbyUids($lookupTableGuid.LT_UID, 0 , 1033).LookupTableTrees #get lookup table count $lookuptableValues = $svcPSProxy.ReadLookupTablesbyUids($lookupTableGuid.LT_UID, 0 , 1033).LookupTableTrees $count = $lookuptableValues.Count +1 #Insert the rows of table in Lookup Table foreach ($rows in $table) { $value_Code = $rows.Item("Project_code") $value_Name = $rows.Item("project_desc") $GUID = [System.Guid]::NewGuid() $LookupRow = $lookuptable.LookupTableTrees.NewLookupTableTreesRow() $LookupRow.LT_STRUCT_UID = $GUID $LookupRow.LT_UID = $lookupTableGuid.LT_UID $LookupRow.LT_VALUE_TEXT = $value_Code $LookupRow.LT_VALUE_DESC = $value_Name $LookupRow.LT_VALUE_SORT_INDEX = ($count ++) $lookuptable.LookupTableTrees.AddLookupTableTreesRow($LookupRow) } $error.clear() #Exceptions Handling : Try { $svcPSProxy.UpdateLookupTables($lookuptable , 0 , 1 , 1033) } Catch { write-host "Error updating the Lookup table, see the error below:" -ForeGroundColor Red -BackGroundColor White write-host "$error" -ForeGroundColor Red }
Initially, I tried to run with value of $value_code as "AACL", the code worked.
But when I tried to insert value of code as "AACL - ALKYL AMINES CHEMICALS LIMITED"
I got following error:
Exception calling "UpdateLookupTables" with "4" argument(s): "Response is not well-formed XML."
I could not understand why this error is appearing as I just added ' - ' to my code value. I checked for validity of ' - 'in the targeted column. No issue with that.
Please help.
Thanks and regards,
Jayesh