Hi there,
As part of my search for a way to import addresses, I tried TableScript (which I love BTW). I have the following code that essentially converts a user's external ID to its "internal" ID:
public class RemapUserIds : TableScript
{
public override void ProcessInputRow(Mapping mapping, Dictionary<string, object> row)
{
var user = User.GetUserBySql(string.Format("SELECT * FROM AccessUser WHERE AccessUserExternalID = {0}", row["AccessUserAddressUserID"]));
if (user != null)
{
row["AccessUserAddressUserID"] = user.ID.ToString();
}
}
...
}
I must call ToString() on user.ID or else the job fails with an error about casting an int to a string. Why is this? I exected this to work without ToString() since AccessUserAddressUserID is an int in the database. Why the conversion to a string? The input row being a Dictionary<string, object> also implies you could store whatever the underlying data type needs to be, and not just strings. Does this apply to all input rows?
Thanks,
Imar