Help to get a CSV/Draft export of items of the same Magic Variable:

Dear friends:

I am having problems in managing the text Variables in shortcuts (maybe due to my poor commandment of shortcuts, so apologies in advance)

Use case is always the same:

  • I retrieve a variable (ex: items in Omnifocus, or Workouts using #toolbar
  • and i want to export a line per event with some variable details (name, url, due date, estimated minutes, name for example) those as a text file to Drafts or any other source
  • If I run the shortcut only once, it does work and I get the expected outcome
    (one line with those elements) what we want, but when I apply the shorcuts to multiple events/dates, then the file/draft appears disordered.

The draft note shows first all names, then all urls, and finally all due dates and estimated minutes …

can anyone help me in structuring my query to have the desired input? I assume it is a lack of programming skills so apologies in advance

I am trying to get the same result in 2 shourcuts (OOF Items and Health Events ) … Omnifocus screenshot as an example

Expected Outcome

16 Questions for Selling in COVID-19, omnifocus:///task/aHy5zpGYbgU, 30
Revisar Stategic Presentation (looking for MIssion and Strategic Priorities, omnifocus:///task/nT7YHz5rJb2, 30
finish reviewing battle cards (commvault, sophos, mcafee), omnifocus:///task/htkQfQ6i1YW, 45
Propose a accountability methodology for Account Plans // Opportunities, omnifocus:///task/a54LRENz66x, 30

vs Actual Outcome

16 Questions for Selling in COVID-19
Revisar Stategic Presentation (looking for MIssion and Strategic Priorities)
finish reviewing battle cards (commvault, sophos, mcafee)
Propose a accountability methodology for Account Plans // Opportunities omnifocus:///task/aHy5zpGYbgU
omnifocus:///task/a54LRENz66x 30

as you can see the shortcut is reading every name first, and then moving to every url to finish with every estimated minutes, despite the declaration of variable

thanks in advance


In your repeat with each item block you have a text block. In that text use the repeat item variable instead of the OF list variable. You can access the specific attributes you want for that repeat item just like you would the OF one itself.

Thanks @slymer for the response. Unfortunately the output is exactly the same… first Draft is compiling the first attribute line by line, then the second and finally the third…

again a screenshot to show

any other hint?? thanks in advance

It worked fine for me except I had to save the repeat item to a separate variable as the repeat item variable when set to type item wouldn’t show me the full properties list after the first use. :man_shrugging:t2:

Here’s my test shortcut that gave me just the one set (limited to 25 on the find) of item details appended to my test draft.

it does work
I believe that setting the variable every time as you suggested did work (and it was a brilliant piece of guessing) … I would provide you with more colour once I could consolidate… but you made my day

Not a guess, just logical :nerd_face::joy:

Glad it works for you.

@sylumer , This proved helpful and corrected my error in using repeat function. I do have one question. The NOTES field of reminders is showing as individual, separate entries using this approach. Example: If in the REMINDERS NOTES field, I have three entries, each one shows as its own ROW in NUMBERS (vice DRAFTS and OMNIFOCUS discussions referenced earlier in the thread).

Task might read “do push up” and Line one, two and three of the NOTEs field might read:
01/04/2022 I did 10 pushups. Today was easy
01/05/2022 I did 11pushups. Today, I took it slow
01/06/2022 I did 12 pushups, Today was hard

In this horrible example, Instead of getting one reminder and note, I would get three rows entered into numbers, but only the first line has the other reminder information.

Ultimately, i want one row/line/entry for this reminder. Any ideas as to how to achieve this?

Thanks in advance!

This is quite a different point if I understand correctly, and so should really be a new and separate topic. I don’t really use Numbers, so there may be other ways to do this that are easier, but a quick test like this…

… gives me a multiline entry in a single cell in Numbers on iOS…

… which I think was the underlying how to question.

You should just be able to apply this formula-based concatenation approach in your Shortcuts repeat loop to build the content that you then add as one entry to Numbers outside of the loop. Something along the following lines.

So the result is like the first time, just generated by a loop rather than a manual entry.

Hope that answers your question.

@sylumer , first, thanks for the reply! The attached picture may clarify my poor description. Note the RED TEXT highlighted in yellow should all belong to TASK 1. Instead, SHORTCUTS is reading these reminder NOTES CARRIAGE RETURN as a separate line. Thats why some have one row between and others have more.

I’m not savvy enough to apply your recommendation to my situation. I see the REGEX entry, but not sure how it would apply. Any further guidance is appreciated.

I’m not sure what to suggest. The text you put in red still seems to match my understanding and the approach I set out.

In terms of applying it, it should mostly just be using the same actions in your own shortcut. I provided the above as step-by-step, simplified examples to allow the logic to be followed. Is there is something in particular that is unclear, can you try and specify what it is so I (or someone else) can try to put it another way?

Also, can you clarify what regex entry are you referring to? I didn’t put and regex in what I laid out, so that point has me rather confused!