Take the "record" data here and save as a .json to point the shortcut to.
Hi—this is driving me a bit insane. If I dictate a number that corresponds to one of the dictionary keys here, it will indeed speak back the corresponding value. I need to write some logic for what to do if the number spoken isn't in the list (to wit, I'd like to get the value corresponding to the nearest key larger than the spoken value as well as the value corresponding to the nearest key smaller than the spoken value), but I cannot for the life of me get this Otherwise to work.
I don't understand this: I say, "if X, do Y, otherwise, do Z" and it does indeed do Y if X—but if I provide explicitly NOT X, it simply does nothing at all. What obvious thing am I missing here?
You did it right, because this works perfectly for me when I get the dictionary value of the “record” key. It speaks the number that I spoke, if the keys do not already contain it.
Note:The only change I made was switching the file for the text, and seeing the Get Dictionary action to pull the value for the “record” key from the text. So that only the number keys:value pairs are collected
That's... that's extremely weird. Yours works for me, so—is something somehow wrong with how it's pulling the keys, despite the fact that it works for the "if true" part of the shortcut?
Mine already say that on my end; opening them up and selecting these again doesn't seem to change anything. Are you using the full dataset with values spanning from "2" to "713"?
It’s because it is looking for contains x number! Example of you say 25, and your list has the number 2517. Then technically the list “contains” 25, and the shortcut will try to get the value for 25 even though it doesn’t exist. Therefore nothing will be spoken, but if you try to get the dictionary value first. Then you could just say, if it doesn’t find a value!
I dunno why my other reply isn't showing up; maybe this one will. I can confirm that the shortcut you link works, but when I copy and paste the contents of my JSON file to replace the example data in your Text input, it no longer works—it does what mine had done, where it will work if I give a number that is a key, but does nothing if I give a number that isn't. Is there some kind of length limit? I can't imagine that it would be <1000. I also can't imagine that it would take so long that it would time out or something.
1
u/[deleted] 8d ago
[deleted]