ShareShortcuts

Reverse Values To keys

chefchip1965
Fork “Reverse Values To keys”

Built something new on top of this Shortcut? Share it as a fork: it becomes a Shortcut of your own, which you manage, and both pages link to each other so chefchip1965 gets credit.

  1. 1Get the Shortcut and change it in the Shortcuts app. Give it a name of its own.
  2. 2Share it from the Shortcuts app and copy the iCloud link.
  3. 3Come back here, paste the link and describe what is different, e.g. “Added a step that uses Apple Intelligence to personalise the text.”
Downloads
72K
Saved
0
Actions
14
Category
Utilities
Version
1.0
Language
EN

This shortcut reversed the values and keys but only works when you do not have duplicate values

What's New

Version 1.0

First release

Version History
1.0 Jan 21, 2019

First release

What it does

14 actions
  1. Comment
    This will only work if there are no duplicate values or keys
  2. Dictionary
  3. Set Variable
    D
  4. Get Variable
  5. Get Dictionary Value
  6. Repeat with Each
  7. Get Variable
  8. Get Dictionary Value
  9. Text
  10. Add to Variable
  11. Get Variable
  12. Combine Text
  13. Text
  14. Get Dictionary from Input

View as code
Beta

Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.

#define color lightblue
#define glyph magicWand

// This will only work if there are no duplicate values or keys

@D = {
	"1": "2",
	"3": "4",
	"5": "6"
}
// TODO: Get Variable not supported: Assign variable here to '@D'.
getKeys({})

for _ in nil {
	// TODO: Get Variable not supported: Assign variable here to '@D'.
	@ReverseD += "\\"{}\\":\\"{@RepeatItem}\"
}
// TODO: Get Variable not supported: Assign variable here to '@ReverseD'.
joinText(nil, ",")
getDictionary(nil)
Open in Cherri Playground Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.

Ratings & Reviews

Write a Review
–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Advertisement

More by chefchip1965

See All

You Might Also Like

See All
Advertisement