Hello.
Associative arrays, that use 'named keys' (also called 'named indexes'), can not be made with some Neobook function. However, they can be created with a small trick. I like this strategy in order to make code more readable (and sometimes shorter). Just for fun, I made a short text on this topic.
Download: http://www.mcdigit.nl/Maliepaard_Neoboo ... _Array.pdf
I hope you will enjoy it.
Best regards,
Reinier
Associative arrays in Neobook
Moderator: Neosoft Support
-
- NeoSoft Team
- Posts: 5628
- Joined: Thu Mar 31, 2005 10:48 pm
- Location: Oregon, USA
- Contact:
Re: Associative arrays in Neobook
I hadn't thought about using arrays like this. Thank you for sharing this with us!
NeoSoft Support
Re: Associative arrays in Neobook
Mi propuesta. This Button. Comment please.
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=BtNbArrayDis
X=517
Y=86
W=99
H=32
Anchor=0
Text=NbArrayDis
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=... DATA FROM FILE OR ENTRY¶setvar "[Ndx]" "Name,Id,Tel,Age,Money"¶setvar "[Obj]" "Gerardo`A`!2259-8814`66`3400,90~Neco`B`!8345-2188`60`2999,25~Paola`C`!8392-9636`34`87987,14"¶¶¶.. BEGIN FUNCTION NbJason Convert ..¶setvar "[SepData]" "`"¶setvar "[SepObj]" "~"¶¶strparse "[Ndx]" "," "[Index]" "[NumIndex]"¶strparse "[Obj]" "[SepObj]" "[Object]" "[NumObj]"¶¶loop "1" "[NumObj]" "[O]"¶ strparse "[Object[O]]" "[SepData]" "[Data]" "[NumData]"¶ loop "1" "[NumIndex]" "[I]"¶ setvar "[Obj.[O].[I]]" "[Data[I]]"¶ endloop¶endloop¶¶loop "1" "[NumIndex]" "[I]"¶ setvar "[[Index[I]]]" "[I]"¶endloop¶¶deletearray "[Data]" "All"¶deletearray "[Index]" "All"¶deletearray "[Object]" "All"¶clearvariables "[NumData],[i],[o],[sepdata],[sepobj],[ndx],[obj]"¶... END ...¶¶..EXAMPLE...¶¶setvar "[Name]" "1"¶setvar "[Id]" "2"¶setvar "[Tel]" "3"¶setvar "[Paola]" "3"¶¶setvar "[sum]" "0"¶setvar "[vYr]" "0"¶¶loop "1" "[NumObj]" "[c]"¶ math "[sum]+[obj.[c].[Money]]" "2" "[Sum]"¶ math "[vYr]+[obj.[c].4]" "" "[vYr]"¶endloop¶math "[vYr]/[NumObj]" "1" "[vYr]"¶¶setvar "[c]" ""¶setvar "[NumObj]" ""¶¶AlertBox "" "Telephone: [obj.[Paola].[tel]] |Name:[obj.2.[Name]]|Money: $[Obj.3.[Money]]|Old:[Obj.[id].4] yrs|----------------------|All Sum= $[sum]|xAge=[vYr] yrs"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=3
FontCharset=1
TextColor=0
TabOrder=7
COSTA RICA
PURA VIDA
PURA VIDA