Working a text expression over and calculating dates from it

Hi,

I am working on a Shortcut that updates a text file with biweekly recurring fixed expenses. The format of the entries is below:

Heading line: “DatePurchase”,“Description (Merchant)”,“Category”,“Amount ($)”,“Type (Income/Expense)”

Expense entries are structured as follows:

0,1000.00,X-Person Paycheque,Income
+1,2000.00,Y-Person Paycheque,Income
+1,400.00,X-Person Account (Savings),Savings
+1,300.00,Y-Person Account (Savings),Savings
+1,120.00,Kids Education Savings Plan,Savings
0,900.00,Mortgage,Expenses
0,300.00,Mortgage,Expenses
+3,300,X-Person CC Payment,Expenses
+3,300.00,Y-Person CC Payment,Expenses

What I know is, it’s a formatted expression; but how to calculate it.

What I have is:

  1. Text field with above text in it.
  2. *Split Text by New Lines function
  3. This is where I fall short, I cannot figure out to add that first CSV part of the data to then add as the need off-set for the following date calculation.
  4. Calculate expression… I know how to get today’s date and then calculate the needed off-set to add; but it is step 3 that has me stuck.

Here’s the iCloud link to the Shortcut’s dev version.

This all ties back to the Youtube video by Take a Shortcut about how he does it. I used it as the start months ago and setup exactly as he has it; but recently though, how can I do it in a wholly contained in Shortcuts way (if possible). This is what lead to me current efforts.

Thank you in advance and if anyone finds this a good brain teaser, thanks and enjoy.

Cheers,

Anthony

That was all very confusing I’m afraid, and the YouTube video seemed only vaguely related. However, I took my best shot on what sort of thing I think you are trying to do based on the sort of things I could see you doing in your shortcut:

The shortcut above just uses my desktop file as the location. If the CSV file does not exist it will create it using the defined header row(s).

Once created it parses your sample text, pulls out the first item on each row and adds that to the current date. It combines that in yyyy/MM/dd format with the rest of the line, and then all of the lines are appended to the file.

I stripped out a fair bit of stuff too. Hopefully, if this does do what you were thinking of, you’ll see why.

Did I get anywhere close?

Thank you @sylumer, that worked perfectly.

Cheers,

Anthony