Skip to contents

sb_upsert_event() imports data frame into a Smartabase event form using the Smartabase API. It requires the user to input a data frame, a valid Smartabase event form name, url and credentials.

If the data frame contains an event that already exists in Smartabase, then that event is updated. If the data frame contains an event does not exist in Smartabase, then that event will be inserted as a new event.

For more details see the help vignette: vignette("importing-data")

Usage

sb_upsert_event(
  df,
  form,
  url,
  username,
  password,
  ...,
  option = sb_insert_event_option()
)

Arguments

df

Data to be imported to Smartabase

form

Name of Smartabase event form

url

Smartabase url e.g. "example.smartabase.com/site"

username

Smartabase username

password

Smartabase password

...

These dots are for future extensions and must be empty

option

More options accessible via sb_upsert_event_option() object

Value

Data frame with extra details about import status

start_date / end_date / start_time / end_time columns

When uploading data to Smartabase, the API requires metadata about when the event started and stopped. sb_upsert_event() will first search for any columns in the data named "start_time" and "end_time", which must have values in h:mm AM or h:mm PM format.

If those columns do not exist, start_time and end_time will be set to the current time and one hour after the current time, respectively.

Likewise, sb_upsert_event() will also search for any columns named "start_date" or "end_date", which must have values formatted as dd/mm/YYYY. If those columns do not exist, both start_date and end_date will be set to the current date (unless the difference between start_time and end_time spans midnight, in which case the end_date will be set to the current date plus one day).

Options

There are also a range extra options than can be supplied to the option argument, including options for setting a different ID column and supplying the names of table fields, among others. In order to reduce argument clutter in sb_upsert_event(), all options must be generated by the sb_upsert_event_option() function. Please see sb_upsert_event_option() for more details.