Append date to end of second line

I am using a simple Shortcut that asks me for a number. This number corresponds to the locker I will use that day at my gym.
This Shortcut takes this number as an input and saves it to a Draft as follows:

Gym Name
80

The Shortcut then runs an action that inserts the date as [[date| %F %R]] as a template

How do I modify this action so that I can append the date right after the locker number?
The desired output should be
Gym Name
80 2024-06-04 16:07

Try this.

https://www.icloud.com/shortcuts/8f543f2a61b0486b9aefcd05f8554b63

On the of chance that your clear contents is just clearing the body of the draft, then you could simplify it and add the Gym Name in the text field and set the update draft action to replace rather than append.

1 Like

Many thanks! I think I have this but wanted to double check my understanding of the replace toggle action within the Update Draft’s action.

My Clear Contents of Drafts action is the following Script action

// Split the draft content into an array of lines
let lines = draft.content.split("\n");

// Check if there are any lines to process
if (lines.length > 0) {
    // Keep the first line and clear the rest
    draft.content = lines[0];
} else {
    // If there are no lines, just clear the draft
    draft.content = "";
}

// Update the draft to save changes
draft.update();

This action just clears the Draft leaving the title.
If I understand you correctly, you are suggesting that this function be modified to clear the Draft completely as opposed to leaving the title intact, followed by passing the name of the gym in the text input of the Shortcut action as the following updated Shortcut does?

So the question I have is - does the replace toggle rewrite the whole text that’s passed as input or just the sections that are different?

What I was suggesting is that the script you have is not required at all.

Replace rather than append will overwrite all existing content. No removal first, just swap the entire thing out.

Then in the Shortcut you save two lines into the draft rather than one line.