I will try to explain it better. The code copy a block from a program and checks each line. The line begans with a date and the following information. If the following information has some points, then the code should COUNT this line as +1 to that date which is in the first place in the line. So, the code takes a block, loop through the block, counts the lines which should be added. But I met a problem when I want to separate how many types came each day. In Array I can add a key and a value, but here I need to have 2 values in one array. The logic should be
if param = firstoption ? firstvalue+1 and secondvalue+0 or
if param = secondoption ? firstvalue+0 and secondvalue+1. At the end I should have results like
date = firstvalue and secondvalue
In my code bellow I can separatly take a count of correct lines for each param (firstvalue and secondvalue). But then I need to merge those two into one
date = firstvalue and secondvalue. And I don't know how..
Code: Select all
blok =
(
15 11 2017 Other
16 10 2017 Fel
20 10 2017 Other
20 10 2017 Other
20 10 2017 Other
20 10 2017 Other
20 10 2017 Fel
20 10 2017 Fel
20 10 2017 Fel
)
oBlock := []
oBlock2 := []
loop, parse, blok, `n, `r
{
line := A_LoopField
StringSplit, linee, line, %A_Space%
ndata = %linee1%.%linee2%.%linee3%
If InStr(line, "Fel")
oBlock2[ndata] := oBlock2[ndata] ? oBlock2[ndata] + 1 : 1
If !InStr(line, "Fel")
oBlock[ndata] := oBlock[ndata] ? oBlock[ndata] + 1 : 1
}
for day, frequency in oBlock2
res .= day ": " frequency "`n"
for day, frequencyy in oBlock
res2 .= day ": " frequencyy "`n"
MsgBox %res%`n`n%res2%