Working With Data
In the previous article, we used the Condition component to compare the scheduled date of a tweet with the current date, but we still haven't retrieved the current date. In this article, weโll dive into how Monkedo handles data, exploring data types, and showing you how to create, process, and format data for your automations.
Data Types
Section titled Data TypesMonkedo components accept and output values in specific data types, which are shown next to the input and output names in the info panel. These data types help streamline how you work with data and include:
Text
Number
Date
Time
File
Yes/No
Table
List
Entity
If youโd like to see examples of these data types in action, feel free to watch our short introductory video:
Data Components
Section titled Data ComponentsMonkedo offers a wide array of components to work with data. These are categorized under the Action section of the component selector, as shown below.
Each type category (Text, Date, Math, etc.) contains specific components to handle various operations. For instance:
Text components can split, concatenate, change the case, or extract values from text.
Math components perform calculations and format numbers.
We recommend exploring these categories to familiarize yourself with their functions. Whenever you need to manipulate data, check the relevant category to find the necessary components.
For now, letโs focus on what we need for our automation: retrieving the current date to compare it with the date from our tweet schedule.
Date Operations
Section titled Date OperationsMonkedoโs Date & Time category includes components like Add/Subtract Time, Create Date, and Date Difference. For our automation, weโll use the Get Current Date component to fetch the current date when the automation runs. This simple component doesn't require any input and returns the current date as its output.
Running the component will display the current date in your local timezone, as shown below.
Another way to get the current date is to use the output of the trigger component of our automation. Remember that the Schedule Trigger component outputs the date at which automation is triggered. This way we do not need to add a new component to get the date. However, if our automation used a different trigger component, we would need to rely on the Get Current Date component to retrieve the current date.
Date Value
Section titled Date ValueDate values in Monkedo are precise up to the millisecond, which means that for two dates to be considered equal, they must match exactly, including the time. In our case, the dates in the tweet schedule only contain the year, month, and day, while the Get Current Date component includes hours, minutes, and more.
Therefore, we canโt directly compare these dates. Instead, we need to extract only the year, month, and day from the current date before comparing it to the scheduled tweet date.
Date Representations
Section titled Date RepresentationsOne key detail to note is that the "When" column in the tweet schedule table appears as Text in the editor. This can be seen both in the result of the Get Values component and in the Query Form when selecting the column.
This happens because the dates we enter in the spreadsheet are not actual Date values but rather text-based representations of dates. Actual date values are created by computers, humans can only enter them as text representations. Some apps may automatically convert these text entries into proper Date values, but in cases like Google Sheets, you'll receive them as plain text. To compare these values, youโll need to convert them from text to Date format, and vice versa. Fortunately, Monkedo provides various components to handle these conversions, so youโre well-equipped for the task.
Converting the Date
Section titled Converting the DateOur goal is to check whether the tweet date matches the current date, ignoring the time. To do this, we can use the Format Date component to convert the current date to a format like "9/27/2024," which matches the format used in our tweet schedule. The component is shown below.
The first input is the date we want to format and we will provide it from the output of the Schedule Trigger. Select the Format Date component and place it near the Schedule Trigger. Then, connect the Schedule Trigger to the Date input of Format Date. Your automation diagram should look like the diagram below. In the diagram, you may notice the numbers "1" and "2" on the connection lines. At the moment they are not important and we will look at them later.
Now, let's continue to set other inputs of this component in the info panel as shown above:
Type: Select "Only Date" since we only need the year, month, and day.
Date Format: The format we used in our tweet table is "6/24/2024". This is Month/Day/Year format. Select this option.
Timezone: Select your local timezone.
The final values of the inputs should look like this:
Running the component will convert the current date to the desired text format, as shown below:
What is Next?
In this article, we mentioned data types in Monkedo and used the Get Current Date and Format Date components to retrieve and format the current date. In the next article, weโll use this formatted date in the Condition component to determine if a tweet is scheduled for today.
Stay tuned for the next step in building your automation!