Doing a replace on a result set value

I’ve got a runscript which is getting values from a SQL table and I need to do a replace on the value, but it seems like it’s not seen as a string when you get it. I’ve tried to add a .toString where it assigns the value but that doesn’t work. Any ideas?

image

Looks like the Addr1 field just doesn’t exist. Are you sure your query returned any result?

You can list the name of fields with a simple generic loop:

var fieldCount = resultSet.Fields.Count;
for(var i=0;i<fieldCount;i++)  {
  Watch.log(resultSet.Fields(i).Name,2);
}

Hi

I needed to add .value to the end of the resultset.fields command. Seems without this it’s not seeing it as a sting but maybe an array or something?

image

Yep, sorry, I should have spotted that. The resultSet.Fields() method returns an object that contains several properties (including name, value and type, among others).