delphi - Comparing values in a dynamic sequence -
i have logic problem need let user configure sequence of compare simple values.
for example, in ini file, sequence stored like:
[fruit] apples=0 oranges=3 banana=4 melon=1 berry=5 lemon=2 in case, ini ident going holding quantity value. ini value representing order of compare. so, need compare this:
{first} if currentapples > prevapples continue... {second} if currentmelons > prevmelons continue... {third} if currentlemons > prevlemons continue... {forth} if currentoranges > prevoranges continue...etc. if sequence changed put berry comparison first, during runtime need able compare these quantities in order. order @ comparisons matter , result in various actions. cannot dynamically create variables in function , assign them name.
i trying this:
var testarray : array[0..5] of boolean; begin testarray[0] := currentapples > prevapples; testarray[1] := currentmelons > prevmelons; testarray[2] := currentlemons > prevlemons; testarray[3] := currentoranges > prevoranges; testarray[4] := currentbanana > prevbanana; testarray[5] := currentberry > prevberry; and evaluate array index in specific order, can't figure out how ini values.
is there simpler way this? if correct way writing hundreds of nested if statements, can try that, seems overkill.
you use inifile.readsection read key names stringlist. should saved in same order stored in ini file. use control mechanizm determine order use.
also might wanna use tmeminifile instead of tinifile tmeminifile stores entire ini file memory. come verry usefull when reading values ini file ofthen becouse regular tinifile reads them hard drive lower performance.
Comments
Post a Comment