ArrayRead + ArraySave

Reading and saving 2 dim data into ANStrArray
ANStrArray is a string concatenated of two dim array, separated by SepaRow and SepaCol
Using 1st column of an array as ID, and second column as value
It is a practical solution to SettingSave and SettingRead used in my Excel tools

CodeFunctionName
What is this?

Public

Tested

Original Work
Function ArrayRead(ANStrArray, ID1)
' finds ID1 in 1st column of 2 dim array passed through ANStrArray
' Returns item in 2nd column
' ANStrArray Seoparated by SepaRow and SepaCol
' SepaCol = "{{$C$}}"
' SepaRow = "{{$R$}}"
Rett = ""
For Each Roo in Split(ANStrArray, SepaRow)
If UCase(CutString(Roo ,"", SepaCol, 1)) = UCase(Trim(ID1)) Then
Rett = CutString(Roo, SepaCol, "", 1)
Exit For
End If
Next
ArrayRead = Rett
End Function
Function ArraySave(ANStrArray, ID1, NewValue)
'
' If ANStrArray is "", then it will be created
' If ID1 not found, it will be added
' ANStrArray Seoparated by SepaRow and SepaCol
'
' SepaCol = "{{$C$}}"
' SepaRow = "{{$R$}}"
NewStrArr = ""
RooNew = ID1 & SepaCol & NewValue
If ANStrArray = "" Then
NewStrArr = RooNew
Else
Found1 = 0
For Each Roo in Split(ANStrArray, SepaRow)
Roo2New = Roo
If UCase(CutString(Roo, "", SepaCol, 1)) = UCase(ID1) Then
Found1 = 1
Roo2New = RooNew
End If
If NewStrArr > "" Then NewStrArr = NewStrArr & SepaRow
NewStrArr = NewStrArr & Roo2New
Next
If Found1 = 0 Then
If NewStrArr > "" Then NewStrArr = NewStrArr & SepaRow
NewStrArr = NewStrArr & RooNew
End If
End If
ArraySave = NewStrArr
End Function

ANStrArray, ID1
or
ANStrArray, ID1, NewValue

Example of ANStrArray
ID{{$C$}}Name{{$C$}}Date{{$C$}}Amount{{$R$}}45{{$C$}}ANmar{{$C$}}2018-06-02{{$C$}}450{{$R$}}87{{$C$}}Amdeen family{{$C$}}2018-04-11{{$C$}}190{{$R$}}

Views 4,747

Downloads 1,420

CodeID
DB ID