Hi All,

I am having some complex logic on my server entity and I used advance query to handle that but in offline mode in mobile app,There is no option to use advance query for Local Storage Entity.

is there any alternative to use complex logic in local storage table?

Thanks in advance


Regards,

Salman

Salman Ansari wrote:

is there any alternative to use complex logic in local storage table?

For complex things against local storage entities, I've resorted to processing in javascript:

  1. Filter your results in the screen aggregate as much as possible (or define the desired output structure)
  2. Add OnAfterFetch action
  3. Convert Entities to JSON
  4. Process / filter with JavaScript 
  5. Convert JSON back to OS entities

I've used LocalData aggregate defined in a screen to produce an empty resultset, usually with an impossible filter (true=false). In these situations, at OnAfterFetch action, I've done the query again and after processing, added the results of my processing to aggregate defined at screen.

This example is just a quick mockup based on OrdersMobile sample app to highlight the principles. For some cases, the first aggregate in OnAfterFetch action is not needed.

Downside to this approach is that the automatic result counters for an aggregate / list widget item counts usually are in need to be managed a bit more carefully. OnScrollEnding action can be used to do this, but as usual, YMMV.

br,

-Mikko(N)

Hi, 

@Mikko, what are you doing in JavaScript that you can't do in the client action?

Cheers

Eduardo Jauch wrote:

Hi, 

@Mikko, what are you doing in JavaScript that you can't do in the client action?

Cheers

On the rare occasions I've resorted to this, I don't think there's been nothing that couldn't be done on client action. Sometimes I just find typed, traditional code is way more powerful option to express ideas instead of having lots of visual code elements to achieve the same thing. Basically for the same reasons why extensions are sometimes used from server side code - to have proper tools to do a task.

I recall typing client side regular expressions and some collection manipulation things inside those JS blocks.

HI 

Below advance query in web I wanted to run in Local Storage Entity..(Mainly where clause)?

Select * from ABC
where
isActive=1
and ((StreetID = @SelectedStreetId  or @SelectedStreetId  =0 ) and
(CountryID = @SelectedCountryID or @SelectedCountryID=0 )and
(CityId= @SelectedCityID Or  @SelectedCityID=0) )

Hi Salman, 

there's no reason why you shouldn't be able to do this with a aggregate on local storage, this is very simple query.  Is there any reason why this is not done as aggregate in Web ?

basically aggregate with 1 source with 4 filters, or am I missing something here ?


Dorine

Thank you all for support.

I have achieved advance sql in Local Storage using below method.


Salman Ansari wrote:

Thank you all for support.

I have achieved advance sql in Local Storage using below method.


I understand your logic, but how about the processing speed ? (because this is on client action right)


Toto wrote:

Salman Ansari wrote:

Thank you all for support.

I have achieved advance sql in Local Storage using below method.


I understand your logic, but how about the processing speed ? (because this is on client action right)


As of now I am processing 50000 records and there is no issue related to that using above method.