Duration?

Tagged: ,

Viewing 6 reply threads
  • Author
    Posts
  • September 2, 2021 at 1:04 PM #45152

    Kimberley Hoffman
    Participant

    Hi everyone,
    I’m setting up a form for recording the duration and lessons I give to my online students. The school pays me per certain activity. Sometimes I will charge more because a student needed more attention than the school usually allows for.

    My first goal:
    How do I set up a simple duration length depending on the action (pick list) taken?
    I need to overwrite it occasionally, but that isn’t the rule.
    Action A= 5 minutes
    Action B= 10 minutes
    Action C = 20 minutes

    In the end I need to sum up how much time I’ve spent with all students and bill that. At the same time I need to state how many actions I took with or for the particular student.

    Student 1
    Action A 5x
    Action B 4x
    Action C 3x

    Student 2
    Action A 5x
    Action B 4x
    Action C 3x

    I’d been recording this in Numbers, and manually transferring the information to my invoice in InDesign. However when I updated to Catalina, Numbers could no longer read my old Numbers files. I had to export them to the Cloud, but that is also a pain in the rear.

    Ideally I would be able to produce a monthly .csv file that I could import into an Indesign table.

    The file should:
    Summarize the activities per student
    Produce the Sum of the total hours worked
    Translate that into Decimals
    Calculate that result against currency

    I have looked here: https://www.tapforms.com/forums/topic/getting-time-difference/
    But that seems like a lot of writing to get a result of 5 minutes.

    Am I overlooking a duration field? Time returns the clock time, not a length of time.

    Thanks.
    Kindest regards,
    Kimberley

    September 3, 2021 at 11:15 PM #45157

    Sam Moffatt
    Participant

    Time field stores time in seconds (maybe milliseconds?) of the time since midnight of epoch, it’s in a sense a date/time field with a fixed date. It’s likely not a great use case for you here if your aim is data export. It’d be usable but you’d need to do some post processing on it.

    In terms of managing this, I’d just have two fields, one for the action name (using a combo box picklist probably) and a second number field for the time duration in minutes. That should let you fill in your own action name and then the number field being duration in minutes can be set to what ever value you want. In terms of automation, I’d go towards having a script field which then sets the number field to the known values. Essentially you need to map the string value you set to a number and at the moment this is likely the easiest way:

    function Fill_Duration() {
    	var action = record.getFieldValue('fld-4807f45c4fd9403c8beef5edce917c6d');
    	switch(action) {
    		case "Action A":
    			record.setFieldValue('fld-4b64c978546045ab944ea4c959d89953', 5);
    			break; 
    		case "Action B":
    			record.setFieldValue('fld-4b64c978546045ab944ea4c959d89953', 10);
    			break;
    		case "Action C":
    			record.setFieldValue('fld-4b64c978546045ab944ea4c959d89953', 20);
    			break;
    	}
    	document.saveAllChanges();
    }
    
    Fill_Duration();
    

    In my sample form, fld-4807f45c4fd9403c8beef5edce917c6d is the “Action” text field with combobox pick list and fld-4b64c978546045ab944ea4c959d89953 is my number field. I’d hide the script field because it doesn’t need to be visible. Then when you export the records to CSV, you’ll have a field with the name and a field with the duration, both of which you can override with custom values.

    I’ve attached a quick form I did handling this, you should be able to do the same by replacing the form ID’s with the ones for your fields (either visible in the field editor underneath the description field or you can get it in the script editor by clicking “ID”).

    Attachments:
    You must be logged in to view attached files.
    September 3, 2021 at 11:34 PM #45160

    Brendan
    Keymaster

    If you don’t care about start and end times and only are interested in the duration of an activity, then use a Number field. The Number field has a Number Format setting where you can specify one of the different Time duration formats. For example, you can have a Number field that accepts HH:MM or MM:SS (hours : minutes, or hours : seconds), etc. There are a few to choose from depending on what you need.

    It would seem that maybe a Student form and a Link to Form field of Activities (One to Many from Student to Activities), which would have the actual duration field on it. Then you add students to the Student form and add their individual activities to the Activities form. As you enter an activity, specify the duration for that activity. You could even have a Date field on it to specify when the activity occurred. You can then have Tap Forms total those up for you quite easily.

    September 12, 2021 at 12:52 PM #45261

    Kimberley Hoffman
    Participant

    I haven’t gotten back to fixing this, but I did want to say thank you. I’ll try again pretty soon.
    Kind regards
    Kimberley

    November 2, 2021 at 8:50 AM #45624

    Kimberley Hoffman
    Participant

    I have picked this theme up again. Is there a way to filter from Date to Date? I set up the files as Brendan suggested. But I only can seem to filter the current and the past month, not for example, a time span, or something similar.

    What am I overlooking?

    Thanks.

    Regards,
    Kimberley

    November 2, 2021 at 8:46 PM #45627

    Brendan
    Keymaster

    Hi Kimberly,

    You can filter based on a span of dates if you add multiple rules to your search, each targeting the same Date field.

    For example:

    Date Field is greater than or equal to 2021-11-02
    Date Field is less than or equal to 2021-12-31

    Does that make sense?

    November 3, 2021 at 12:13 AM #45630

    Kimberley Hoffman
    Participant

    Thanks. I knew it had to be there – that tree in the forest :)

Viewing 6 reply threads

You must be logged in to reply to this topic.