Smart rules ordering

Try your original approach first; it will work, you’ll be able to put things directly in DTTG; play, and see what suits you best :slight_smile:

Whilst AS is not JS, I’m a scripting novice and have readily produced working scripts for - at a guess - more than 20 of my rules. None of the things you are (apparently) doing is particularly complex; both rules or AS will get you where you want to go :slight_smile:

hilariously i am failing on both fronts.

in DT i cannot figure out how to pass state between the rules (so that the final generic step is renaming but the others are passing values) and with the cloud based approach i seem to have to be online on ios AND the shortcut i created doesn’t save the file nor does it prompt for a directory. just says the shortcut ran when i execute it via the share menu.

To the best of my knowledge you can’t; so if you are expecting your “BMW-rule” to say variable n = “2021-04-25 BMW invoice” and for a final rule then to apply change name to n AFAIK you can’t; as such, those steps would need to be included in each rule (and then, probably, terminated by a Cancel action). We’re back to why I use a script :wink:

(Please note: I may be wrong; I have never read that variables can be passed from one rule to another, and have seen no obvious way to do so).

I’ve never used shortcuts on iOS, so I’ll be of no help there; @Solar-Glare uses them non-stop IIRC, and might be able to assist.

hazel and javascript, here i come :wink:
yes, it seems to be wiser to bet on scripts i think. any solution i can currently forsee with smart rules seems brittle at best.

There’s no mechanism like in Hazel. You could set a tag or metadata in rule 1 that you use and reset in rule 2.

:+1:

Insofar as it helps you at all, this is the basics of the script I use to do what you seem to be atempting to do:

on performSmartRule(theRecords)
	tell application id "DNtp"
		repeat with theRecord in theRecords
			set docuText to plain text of theRecord
			if docuText contains "invoice number 54321" then
				set theDest to get record at "/Group/Subgroup" in database "Database"
				set name of theRecord to "Personal Insurance - Invoice"
				move record theRecord to theDest
				set unread of theRecord to false
				set locking of record theRecord to true
			else if docuText contains "invoice number 12345" then

Obviously the set & do stuff routines could be in a subroutine which was called by each if/else; that would be tidier, but when I was writing the script that just didn’t happen :wink: And I’m too lazy to go back and tidy up a script which already does as it should.

thanks for sharing your script