Elements do not see in the list, only the first

Gabriele, posta blocchi in inglese, altrimenti nessuno li capisce

opsssss, sorry so much

1 Like

If you added a component and it stopped working, look for the reason in the component. See what you get at the component output from KIO4. You must receive the data as in the file, i.e. lines separated by a new line and columns with commas.

Hello Gabriele,
(i'm Italian too, but I write in English so everyone can enter this conversation).
It is not clear to me what you are doing.
Let me try to say what i have understood: you read a csv file, in which the data are comma separated.
What you create is a list of all the data (bollature :slight_smile: giornaliere) of daily timestamps when you get in and get out of the office/plant.
You put all together into a list variable (global_elenco_timbrature) then you want to create one record for each day and put these records in a list called "lista".
To do this you point to the first row in global_elenco_timbrature, you select the elements from 2 to 7 in order to create the record fro one day. Am I correct ?
But when you go to the next row in the elenco_timbrature list, the elements (of the second row) shouldn't be from 9 to 14, and so on ?
Your variable "elemento" is an item of elenco_timbrature, then the number of items in that list is = to all the data of the csv file. So when you skip to the next row the elements do increase by 7 (or the numer of items for one day).
As I said, maybe I did not understant your algorithm, but it seems to me that you are missing this increment.
What are your thought on this ? Would this help you ?
Ciao, Ugo.

I think you didn't understand this algorithm ;). When he read the file with the built-in "File" component the algorithm was working. After adding the component from kio4 it stopped working. I think this component modifies the text somehow. It needs to see what it gets at the component output, maybe it's not a valid csv anymore.

Ok Patryck,
but the elements that he uses are always the elements from 2 to 7 which are read from the global_elenco_timbrature list variable. If he does not increment the elements by 7 (or whatever is the modulo) he always uses the same first 7 elements (I guess :thinking:).
Honestly I did not try the algorithm, I just thought on it :grin:
Let's wait for his answer.... :hugs:

Look above the posts and read what he wrote earlier. The algorithm was working. You have to know what is at the output of the new component because you can't guess.

1 Like

Dear Gabriele,
I have rewritten the algorithm because I saw that you were using the variable elemento instead of the variable elenco_timbrature (the block select list item list needs a list name).
Please take a look here below. This is a simplified version : I create manually a list and from that list I create a secondary list putting together 2 elements (the value of modulo) each time.
I run it on my phone and it works: from a 12 elements primary list I get a secondary list of 6 elements each one composed by two elements of the primary. (it's longer to say than to see it working :grin:)

BUT => take care of what Patryk is saying: you must be sure of what KIO4 is giving you back when you split the file and create the elenco timbrature list.
Cheers,
Ugo.
image

1 Like

Thank you very much for the answers, as soon as I have a moment of time I try and study it anyway, to be clear:
each line is an "E" entry "U" exit stamp, date, hour and minute and I would like these to be in columns.
with the "file" method it was ok, but I need to create the files and then use KIO.
Patryk_f he understood perfectly well

Thanks a lot to everyone

here's what kio4 comes out with this file24615Dicembre2020.txt (50 Bytes)

So instead of a list of lists, you have one long list. I don't know what this extension is and what it is for, but something is wrong here. Apply @uskiara algorithm in this case.

2 Likes

Gabriele,
the new txt file is really short. The content is not enough to test meaningfully the algorithm unless we create dummy data.
The structure seems to be:
24615,U,11,12,2020,12,10
24615,E,11,12,2020,12,10
where:
badge code 24615, U(=Uscita-Exit), day, month,year, hour, min 0x0A (LF)
badge code 24615, E(=Entrata-Entry), day,month,year,hour,min 0x0A (LF)
If yes, in your sample it seems that entry and exit time are the same ?
Is it correct ?
Are there other (hidden) data in the original file ?
Ciao, Ugo.

PS/ dumped in HEX

@gabriele_lorenzoni

It would really help if you showed ALL your relevant blocks, this includes the blocks you use to create the file in the first place - where is the data coming from, how/why create a file?

From what I can see you do not need to use the Kio4 Explorer extension, the File component will do all the work for you.

sono dovuto passare da "file" a "kio4" perchè con "kio4" posso creare le directory anche nel percorso "/mnt/sdcard/" e all'interno creare file cosa che con "file" non riesco o comunque se testo con "ai companion" il percorso è diverso. E se cerco di creare il file mi da errore perchè vorrei che leggesse il file, se esiste, difatti se non esiste mi rende errore" file not found", poi lo crea...
I attach file aia
thank you so muchCartellini.aia (55.6 KB)

The problem is that if the component that reads the file recognized "LF" then my algorithm shown above would work. Unfortunately, something is wrong and the lack of LF means that this algorithm does not work because there is one long list.

1 Like

As I wrote. The extension misses line breaks when reading. The file saved in the phone memory is correct.

1 Like

I don't know if it makes sense to make an application that creates its own folder. From android11 it will not be possible and it is best to save the data immediately in the ASD directory or export it online to a Google sheet. Another way would be to store the data in TinyDB in the application memory and be able to export it to a file if necessary.

1 Like

hello, thanks for the information on android 11, I immediately put the advice into practice but with the "FILE" element I can't write on "Android / data /" + my folder, where am I wrong? I wish I could use "FILE" with the same path with both "ai companion" and compiled apk, sorry I'm at the beginning ...

I think @Anke could help with the new file read / write system. I am still confused with this and I do not have a new android for testing. Then, if you deal with enrollment in asd, we will advise you on the correct processing of your data.

You can use an extension that detects developer mode. Then build a block "if developer mode then link1, else link2.

See here:

1 Like