Is there a way of stopping Double Print from LocalStorage

HI, when I output Print data from LocalStorage, If I were to output again, instead of overwriting the data that has already been output, it just creates another list of data below the previous list of data. Is there a way of stopping this? Please see attached picture

Thanks
Will.

You’ll need to give some more information here. How are you outputting?

Hi George, I’m outputting with concatenation to a TextArea i.e

       Dim Saves(), datv
       
       datv={CTP: Numc, Ra: RFb, Rh: RFc, Rt: Rfd, Rf: Tolx, Ru: Rff, Re: BMb} 
       
       Saves=JSON.parse(localStorage.BrgDst)
       Saves.push(datv)
       localStorage.BrgDst=JSON.stringify(Saves)
       
     End If
   Next
   
   If Trg>0 Then
     TextArea64.value = new Date() + vbCRLF + vbCRLF + "    Re-Observe Points > Specified Tolerance  "  + vbCRLF + vbCRLF 
     + "    BM (Red Lev) =  " + localStorage.var20TextBox195 + "    Tolerance =  " + localStorage.var26TextBox209 + vbCRLF + vbCRLF 
     Dim Saves, j
     Saves=JSON.parse(localStorage.BrgDst)
     For j=0 To UBound(Saves)
       If Saves[j].CTP Then
         TextArea64.value = TextArea64.value + Saves[j].CTP +") " + "    RF1 = " + FormatNumber(Saves[j].Ra,3) + "    RF2 = "  + FormatNumber(Saves[j].Rh,3)
         + "    Diff = "  + FormatNumber(Saves[j].Rt,3) + "    >Toll = "  + FormatNumber(Saves[j].Rf,3)+ vbCRLF + vbCRLF
         currentRecord=j
       End If
     End If
   Next
   
   ChangeForm(Form74)
   
   If Tra>0 Then 
     TextArea64.value = new Date() + vbCRLF + vbCRLF + "    Adjusted R&F's and Corrected RedLevs  "  + vbCRLF + vbCRLF 
     + "    BM (Red Lev) =  " + localStorage.var20TextBox195 + "    Tolerance =  " + localStorage.var26TextBox209 + vbCRLF + vbCRLF 
     Dim Saves, n
     Saves=JSON.parse(localStorage.BrgDst)
     For n=0 To UBound(Saves)
       If Saves[n].CTP Then
         TextArea64.value = TextArea64.value + Saves[n].CTP +") " + "    RF Diffs = " + FormatNumber(Saves[n].Rt,3) + "    Mean RF = "  + FormatNumber(Saves[n].Ru,3)
         + "    Adj RedLev = "  + FormatNumber(Saves[n].Re,3) + vbCRLF + vbCRLF
         currentRecord=n
       End If
     End If
   Next
   
   ChangeForm(Form74)   

Is this code formatted properly? It seems to repeat code.

There are two separate blocks of concatenation that share some of the same variables which are set to output via a condition set earlier in the calculations (As seen in the first line of both blocks…If Trg>0 Then… If Tra>0 Then…) I do understand that “If”, and after the first block of concatenation is output, and then the second block of concatenation is output, it (the second block) will already have unwanted data contained and output along with the list of wanted data.
What I have found is, that even if I were to have one block of concatenation , because the LocalStorage Array datv={CTP: Numc, Ra: RFb, Rh: RFc, Rt: Rfd, Rf: Tolx, Ru: Rff, Re: BMb} is being loaded up with data via a For Loop, on each press of the Function Button (Calc) it two repeats the same output. If I could find out how to overwrite instead of repeat for this then ,maybe I could do the same for my first scenario.
Thanks
Will.

I just used the format command in AppStudio’s Code Window (right click to do it yourself) to clean up the formatting of the code.

This doesn’t look like AppStudio issue, but rather code which needs to be carefully reviewed and debugged.

Stash a copy of this code someplace safe, then simplify it until you understand what is going on. You should be able to figure this out when you do that.

Ok George, I’ll go through the code using that.

Thanks George.