Help with generating a sheet file from various labels

Hello everyone
I've (almost) made up an app that counts how many times stops occured, how much time the workflow has stopped and which were the causes.

Now...I need to generate a report with all these data and I want to make it something that can be processed by the upper levels in order to generate statistics.

What you see in the image is the running screen of the app. There are columns filled with rectangles for every type of stop that can occur.

Each rectangle is made up of title (name of the stop), below the title is a counter of seconds and minutes, below this counter there are two buttons that starts, pause and stop (with long press) the upper counter and between these buttons there's a counter that counts how many times the STOP button was pressed.

All the counters are defined as labels.

Every rectangle is defined by blocks like in the following image:

How can I generate such report that must contain the name of the stop, the sum of counters (seconds and minutes) and the stop counter?

I tried using TinyDB but I'm limited because I can't figure how to generate a csv file with such data in it.

Any help is appreciated. Thank you in advance.

Append to a file (use the file component)

name, sum, counter

use the .csv extension for the file, you can then open this in google sheets or Excel.

Don't know how to edit my post to add stuff so I'm leaving this here


The first set of blocks is the solution (I think) that I found to create the content of csv file. Any corrections are welcomed.

The second set of blocks is the creation and save of the csv file. But here lies the problem: whatever place I give, I can't find my file (Android 12, unrooted). And I've tried: "/", "/Downloads", "/Documents", "/sdcard/" and as the last try, the line you see in the block.

The program will be used on an old Android device, don't know yet but surely less than Android 8. Will this make a difference in creating my file?

Thank you in advance!

If filescope is App then set filename to /response.csv

The file will be saved to:

/storage/emulated/0/Android/data/<packageName>/files/response.csv

This file location will only be accessible from your app.

You are trying to store the file in the root directory of the emulated sdcard. This is not possible anymore... see also Some basics on Android storage system

Probably you prefer to store the file to shared storage? What do you plan to do with the file after storing? Use file scope = Shared and filename /Downloads/yourFilename.csv and set the default file scope in the Screen1 properties of the designer to Legacy

Taifun

The file must be used in the upper offices for statistics, so it must be available in some way, either by sending it to an email address (probably directly from the app) or from outside of the app, sent manually.

The File component uses/requires a relative path if the FileScope is "Shared" or "Legacy". If the FileScope = App, ONLY the filename is needed to store the file in the ASD (that means the file will be automatically redirected to the ASD). However, the ASD is no longer visible on devices running Android 11+. Also, as @Taifun said, other apps can't access your app's ASD.

So if the file needs to be viewable from the device, you need to save the file on Android 11+ devices in one of the Shared folders (/Download or /Documents) in order for this file to be viewable. However, only your app has access to this file. Otherwise you must use SAF. However, the latter requires that the file was saved in the Shared folder /Documents, since the /Download directory is not accessible (cannot be selected) with SAF.

See also here:

Which means, just store it in ASD as @TIMAI2 suggested and use one of the email solutions to send it from there

The activity starter solution will work only from shared storage
Taifun

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.