0

I need to query a number field from a table, and the value to query, is comming from a BuildRowsetFromString. Whenever I try to query, I get this error:

Failed to convert parameter value from a String to a Int32. Input string was not in a correct format.

How can I convert the string BuildRowsetFromString generates, to a number?

  • 1
    Please can you provide an example of how you are using BuildRowsetFromString()? – Eliot Harper Sep 6 '16 at 2:47
  • Hard to help when there's no source code posted. – Adam Spriggs Sep 12 '16 at 14:55
1

I don't think so AmpScript can covert string to int. You have to use SSJS with a combination of AmpScript to convert string to int.

Also, use JavaScript parseInt function in SSJS like below.

%%[
SET @FirstNumber = "10"
]%%

    <script runat=server>

    Platform.Load("core","1");

    var firstNumber = Variable.GetValue("@FirstNumber");
    var secondNumber = 10;
    var add = secondNumber+parseInt(firstNumber);
    Variable.SetValue("NewNumber",add);

    </script>

 %%=v(@NewNumber)=%%

Output: 20

| improve this answer | |
-1

The returned result is of type String, try to parse by using integer.valueof(s); and check before if it's different from NULL.

| improve this answer | |
  • I get this error: The function call uses an unrecognized function name. Function Name: integer.valueof – Paulo Manrique Sep 5 '16 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.