Will Robinson
Will Robinson

Reputation: 1

Storing data from from 2 separate LocalStorage locations to another single LocalStorage location

This is an App Studio NSB app. Can I store LocalStorage data from 2 separate LocalStorage locations to another independent LocalStorage Location.

The problem I am having is getting the iterations on the for loops correct. Or is what I am doing just not possible. (I am an amateur hobby coder)

Dim saves, u
Dim saves, i

saves=JSON.parse(localStorage.BrgDst)

For i=0 To UBound(saves)
If  saves[i].Count Then 
Numb = (saves[i].Count)
RFa =(saves[i].RiseFall)
currentRecord=i  

For u = UBound(saves) To 0 Step -1
If  saves[u].Counts Then
RFb =(saves[u].RiseFallX)
currentRecord=u

Dim saves(), datix

datix={PNB: Numb, MRa: RFa, MRb: RFb}

saves=JSON.parse(localStorage.BrgDst)
saves.push(datix)
localStorage.BrgDst=JSON.stringify(saves)

End If
    Next u 
        End If
           Next i

This is what I want

1) RiseFall = -3.822 RiseFallX = 3.821

2) RiseFall = -0.617 RiseFallX = 0.617

3) RiseFall = 0.363 RiseFallX = -0.364

But this is what I get

1) RiseFall = -3.822 RiseFallX = 3.821

1) RiseFall = -3.822 RiseFallX = 0.617

1) RiseFall = -3.822 RiseFallX = -0.364

2) RiseFall = -0.617 RiseFallX = 3.821

2) RiseFall = -0.617 RiseFallX = 0.617

2) RiseFall = -0.617 RiseFallX = -0.364

3) RiseFall = 0.363 RiseFallX = 3.821

3) RiseFall = 0.363 RiseFallX = 0.617

3) RiseFall = 0.363 RiseFallX = -0.364

Upvotes: 0

Views: 107

Answers (1)

ghenne
ghenne

Reputation: 1903

First, a better place for this would be the AppStudio discussion board: https://discuss.appstudio.dev/

I notice in one place you use saves[i].Count. Later, you use saves[u].Counts. There are no Count or Counts properties in AppStudio BASIC. Could you mean saved[i].length?

Upvotes: 0

Related Questions