Sander Kristel
Posts: 0
Joined: Sun Dec 29, 2013 4:47 pm

Read mutliple Databse items into Local variable

Hi,

I'm trying to read multiple database items into a local variable and then show them 1-by-1. I'm using the folowing but getting a NILL return back? Anyone please?

I have added the "LanguageVariable" local variable and linked it to the Database item and have added the Skip local variable and linked it too?

var Taal = localStorage.getItem('LanguageVariable');
var i = 0;
while ( i < 5 )
{
localStorage.setItem('skip', i);
ReadLanguageService.execute();
i = i + 1;
Taal = localStorage.getItem('LanguageVariable');
alert(Taal);
}

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Read mutliple Databse items into Local variable

I'm not 100% sure I understand the question but..

A local storage variable holds a single value. You can store multiple values if you use an array or JSON. For example: {"value1", "value2"}

Did you use the browser console to see what actual value gets stored in LanguageVariable? http://docs.appery.io/documentation/d...

Sander Kristel
Posts: 0
Joined: Sun Dec 29, 2013 4:47 pm

Read mutliple Databse items into Local variable

The value is NILL - I want to read each record in a table and after each record show one of the values?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Read mutliple Databse items into Local variable

I'm still not sure of the setup.. if LanguageVariable is null -- did you check that you are setting it correct? Where are you setting it?

Sander Kristel
Posts: 0
Joined: Sun Dec 29, 2013 4:47 pm

Read mutliple Databse items into Local variable

I created a new DB Read Service - Added "skip" to the request variables - added the service called it "ReadLanguageService" to the page - mapped the "skip" local variable to the service request and mapped the "Languages" field of the service to the "LanguageVariable" local variable - I think this should be set when I invoke the ReadLanguageService.execute()?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Read mutliple Databse items into Local variable

Yes, the request parameters should be set (mapped) when you invoke the service.

Return to “Issues”