Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

numeric values mapped from storage to query parameters for a service which uses parameter substitution causes an error

Hi Conor,

You have incorrect service response settings. Please make these parameter to mach your actual response.

Also, i tried the same thing (with number-type column in db collection) and i don't have such problem. Please check your actual response may be there returns something like "0" instead of 0.

Regards.

conor roche
Posts: 0
Joined: Wed Mar 25, 2015 6:56 pm

numeric values mapped from storage to query parameters for a service which uses parameter substitution causes an error

Yuri you are misunderstanding the problem it is not the RESPONSE. It is the REQUEST that has the bug. I can reproduce this in a few steps using a simple service. My account has a limit of 1 app so I can't create a simple app to demonstrate it but I can give you the exact steps to reproduce so here they are:

  1. Create a new phone app using the latest appery builder.

  2. Create a numeric local storage variable like this:

    Image

  3. Create a REST service that maps the numeric service parameter to a request parameter that is part of the url. Here is the settings of this service:

    Image

    And here are the request parameters:

    Image

    The response here doesn't matter but for completeness here it is:

    Image

  4. Create a new datasource using this service on a page like this:

    Image

    In the before send event mapping map the numericVar storage variable to the userId service REQUEST parameter here is an example:

    Image

  5. Finally add a button to test the service and in its on click event add this javascript:

    // set a number in the numericVar variable
    Apperyio.storage.numericVar.set(2056);

    // call the service that uses this variable as a REQUEST parameter
    NumericStorageBugDs.execute({});

  6. Click the button and you will get this javascript error in appery.js line 564:

    Image

    A workaround as I mentioned earlier in the post is to explicitly convert the request parameter from a number to a string in javascript like this:

    Image

    Again I want to point out that for a user this shouldn't be necessary.

    Yuri I hope that this helps you to finally understand the problem.

    Regards,
    Conor

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

numeric values mapped from storage to query parameters for a service which uses parameter substitution causes an error

Hello,

Please unroll error to see all error stack and send us screen shot.

Change
return "" + value;
to
return String(value);

conor roche
Posts: 0
Joined: Wed Mar 25, 2015 6:56 pm

numeric values mapped from storage to query parameters for a service which uses parameter substitution causes an error

the very first image i posted for this issue has the screen shot of the error.

https://d2r1vs3d9006ap.cloudfront.net...

All you guys have to do to fix is either change the code that builds the map of params from storage variables to convert them to strings or else on line 564 of appery.js change the value to a string e.g

swap

var newValue = value && value.replace(this.PARAM_PATTERN, _performParametersSubstitution);

with

var newValue = value && value.toString().replace(this.PARAM_PATTERN, _performParametersSubstitution);

I don't have any more time to spend on this, it's your product and I have given more than enough details on this so you either care or don't.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

numeric values mapped from storage to query parameters for a service which uses parameter substitution causes an error

Hi Conor -

Thank you for pointing this out -- we've reported this issue and we will fix it.

Return to “Issues”