This is little unusual, maybe controversial…?
Let’s stick to the techstuff.
I’m using the same data on various places within different applications.
At the moment, what I can think of, there are two websites and one Xojo application, sharing the same data.
In this case, it’s languages. There will be more. More data and more applications that share different things.
So… to solve this, I “ship” data from one service to the other.
This is all done behind the scene, with no human interaction.
I have languages: Swedish, Danish, English.
The shipping goes like this: (ID + name)
23
Swedish
19
Danish
7
English
DIM arrLanguages(-1) as String = split(strPage, EndOfFile)
Now…
This works…
However, a two dimensional array is sort of easier for my mind to visualize … but how to create such!?
I know, I can look through all … but my question is really, is that the easiest way to solve it all!?
Maybe there is an easier way?
Since the “code” snippet above is made by me, I might write the data in the different order, if that would be to prefer!?
Obviously split wont work to create a 2d array
Nor will a simple list of strings unless your OK with the ID’s being handled as strings as well ?
If so something like (this is off the top of my head here in the forums so it may only be close)
DIM temp(-1) as String = split(ReplaceLineEndings(strPage, EndOfLine), EndOfLine)
// the file is ID followed by language
DIM arrLanguages(-1,-1) as String
REDIM arrLanguages(ubound(temp)/2,1) // half as many rows but 2 columns
for i as integer = 0 to ubound(temp)
if i mod 2 = 0 then // we're on an ID row
arrlanguages( i / 2, 0) = temp(i)
else
arrlanguages( i / 2, 1) = temp(i)
end if
next
[code] DIM i as Int64
FOR i = 0 TO UBound(arrLang, 1)
DIM strID as String = arrLang(i)
i = i + 1
DIM strName as String = arrLang(i)
i = i + 1
DIM strSortfield as String = arrLang(i)
TextArea1.AppendText "ID="+ strID + " -- strName=" + strName +"-- strSortfield=" + strSortfield + EndOfLine
NEXT[/code]
I’m using database in both ends but I intend to use the ID from the “original” database as a pointer in all other places… Silly? Yes… but in my mind it will work.
If English is always ID 7… that’s how it will be treated all over… no matter the actual ID in the actual database. Oh, excuse me for explaining! I now think it will simply make things more complicated!
DIM temp(-1) as String = split(ReplaceLineEndings(strPage, EndOfLine), EndOfLine)
That’s a new one! Thank you!
[quote=152358:@Jakob Krabbe]OK, I’m in.
Since I’m the designer in both ends, how shall I send the data to make a split for the 2d array?
Is that even possible…?
[/quote]