Row and Column entries

Keep the bib numbers in a list under a TinyDB tag, with the option to add new bib numbers at the end. When a new bib number (say 7) is added, write a new file /7.txt with \n for empty line.

Load a List Picker from the bib numbers list in the BeforePicking Event.

When a bib number (say 7) is selected from the List Picker, try to read the file /7.txt .
When the file arrives, keep it in a global variable and show it in a Label.
Have the new line entered by the user into a text box under the label.
When the user hits a Done button, add in the new time to the global variable and rewrite the global variable. Update the Label.Text from the global variable.

By the way, what so the colons mean, and are the digits paired in your sample?

Thanks for the feedback. Will try that :slight_smile:

Yes they are paired. Basically, the bib number represent the athlete, while the other numbers is the time. So, when I Press Enter, the Bib number will determine which row the timenow is being added to.
at the end, I want to be able to export as a csv and open in excel, achieving something like this:

bibs

(Sorry I just had the arrangement other way around in initial post, but the principle stays the same)

If you are saving times (hh:mm:ss ?) for Excel, now is a good time to see if you are saving them in a text format acceptible to Excel time input formats.
Build a sample csv (Comma Separated Values) text file in Notepad and try to import it into Excel, to be sure. You will need commas between columns, and probably " " around each cell value for the special characters.

When collecting the times, JOIn them onto the old row contents for that bib file, with extra comma and quotes. The blue square on the JOIN block lets you add sockets.

When you are ready to export to a csv file, run through your list of bib file names, and copy them onto a temporary list of bib files to append onto your export csv text table.

  • Add a File component to grab a bib file for export, and another file component for csv table export.
  • Issue a read for the first item on your temporary bib export list. When that file arrives,
  • append the contents onto the output csv, with \n between lines
  • remove item 1 from the temporary bib export list,
  • and check if the list has been exhausted yet.
  • If exhausted, close up the export.
  • If not empty, issue another read for the new item 1.

Thanks for the reply.

I do not understand? I need 2 files. One is ony a temp file that write the current bib no an timestamp to the actual file, adding the time value to the given row?
If you could help me with a simple example, it would be much appreciated’
Thanks

Jakes

Good day,
So, I am trying to develop an App that log times (seconds) according to an Athlete (Bib No)
I have tried to write to a normal txt file, but maybe I do it wrong. Is it better to use TinyDB?
And also, If I know the amount of entries, it would been easy to create the table, but every race is different.
Each Row must represent a Bib number, starting at 1, while the times is being added to each Bib Number. Also, it must handle multiple time entries per athlete, for example I have 10 athletes , running around a track, for an hour. This timer will log each lap time according to their bib number.
What is the best way to do it, and any examples perhaps? I am getting confused with Lists and index vs Tags. For example, what do I use to get the row I want to add to?

bibs1

Any help will be appreciated. I am a noob here :frowning:

Thanks,
Jakes

Hello Jakes,

So, you found a way of capturing a runner's Bib per your previous discussion QR Scanner Speed ? Great.

What you do to post the results depends partly on how your timer works.

Essentially, you want to create a database. The database can be constructed using a csv text file or a List to record results. This is the developer's choice.

OK, to start, how would you make your table using ten runners? If you can do that (you said it would be easy) , you can record five or fifteen or... So, how would you do that? If you provided that method, someone can provide specific advice to make the process generic so it can be used for multiple runners.

Is it better to use a TinyDB? What you use depends on what you want to do with the data. You need some place to store the final results. If you store internally in the Anddroid using a List, that information disappears when you turn the Android off. You need to store the results in persistent storage. With App Inventor it means TinyDB or a File if you store to the device or FirebaseDB or CloudDB or a GoogleSheet or a TinyWebDB etc. to store 'in the Cloud' . The basics are described here> Databases for a TinyDB.

Confused about Lists? Sajal's Tutorial Use a list to capture the data. Then save the List in a TinyDB or File or Cloud storage.

Confused about File and other storage options?

what do I use to get the row I want to add to? It depends on whether you create a List or a csv.

With a List you can use one of these Blocks

Lists
Lists blocks

1, 2, 8, 5 is a row , 1 is index 1, 2 is index 2, 8 is index 3 and 5 is... if you store your data as a List of csv text

App Inventor has Blocks to let you know how many 'rows' (items) are in a simple List and allows you to manipulate the data as described in Sajal's tutorial.

Maybe this helps?

Regards,
Steve

Let me offer some extra advice regarding how to think about your problem …

I did not see any words in your problem description for important data you need to collect.
Naming your data gives you a firm foundation upon which you can build your thoughts.

You have runners running a race whose bib_number is logged together with the runner_checkpoint_Instant they pass each checkpoint and complete a lap.

Unless you are running a race of clone robots, each runner passes each checkpoint at a different Instant, so they need to be kept individually, addressed by the combination (runner, checkpoint number).

A lap is the interval between one checkpoint and the next.
A runner’s (identified by bib_number) lap_time for a lap is calculated from the Duration between the two checkpoint Instants at the start and end of that runner’s lap.

It’s perfectly okay to use two different storage techniques for the data collection phase during the running of the race and for the summarization, filtering, and presentation phases.
By doing this, you are breaking down a complex problem into smaller, simpler problems.

For each phase, use the data storage technique that makes that phase easy, then write code to transform a copy of that data into a format suitable for the next phase.

Don’t try to save storage space by overwriting your input data. That would lead to confusion and muddy the trail you leave.for debugging.

Thanks for the replies,
Steve, I have decided to put the QR scan method on ice, as I need a high speed scanner. The idea is to create a timekeeping app for normal mobile phones.

I have worked through the lists tutorials you gave me, thanks Ive learned a lot.
Unfortuantely I came across a brick wall, as I cannot find a way to add indefinite lists and columns. I will never know how many riders will attend, and neither the amount of laps. To write an app that only handle 10 or 20 riders, or just a limited amount of laps is useless, I guess.:frowning:

Here is what I have. I made a simple app with two text boxes, one for the bib number (index) and the item to be the time. So the time will be added to the indexed column.

??

Just keep adding items to your lists ?

Use Taifun's dynamic table to display the data ?

Thanks for the help. Unfortunately I couldn’t get it to work. It is easy to add Items to your list if you know the entries. But in my case I do not know. It could be 2 entries. It could be 100.
So, I guess I have to write to a TinyDB, and then retrieve the values into a Table.

So here is what I have. How do I get the values of other tags displayed? I only have one Column. When I enter the times for BiB no 2, nothing shows up

TinyDB1

Could you just confirm how your data is set out ?

image

and the numbers in the table ?

Hi, actually the other way around so the bib numbers and times are on rows, not columns. But that arrangement can work. The idea is the other way arround, but either way will work. At least it will be easier to process in excell then.

So from that table:

Bib Number 2 completed Lap 8 in 6 time units ?

Bib Number 2 completed Lap 8 in 6 time units ?

Yes that is Correct :+1:

Here is an example that may help you on your way. I used Scott Ferguson’s Stopwatch example as a base to get the times, then added procedures to record individual times and to create the table. I used Ken’s TableView extension (remember to add the “\n” to the Delimiter box in the Designer). Lazily, I created a base table with 10 laps, this can be extended, or developed to be more interactive. There is also a choice of recording the elapsed time or the individual lap times in the table. Just drag in the respective procedure to change this to your liking. There is no error checking on the lap number entered, this won’t affect the table, but will show issues in the individual records. Data is saved to a tinydb, in readiness for export. Once you have the lapdata in excel/google sheets, you can use a pivot table to easily replicate the table layout.

SCREEN

AIA

LapTimes.aia (32.7 KB)

BLOCKS

Thank you very much. Will work through this quick

This is almost exactIy want to do. Is there a way to automatically get the last lap number instead of adding it manually?

I’ll have a think about that. However if you extend that list to 100+…

Well, I found that I just have to add the first lap number of each Bib, thereafter, even if I enter the second lap as 99, it automatically add the time value to the correct cell.

Basically, just have to get this TextBox2 replaced by the last value +1 of the lap number of the specific bib number.