AutoTools json update won't write to result variable

Discussion in 'AutoApps' started by obscurereference, Nov 11, 2016.

  1. obscurereference

    obscurereference New Member

    Joined:
    Mar 6, 2015
    Messages:
    24
    Likes Received:
    1
    I've found that when updating json data, if the 'Result Json' variable is the same as the 'Json Input' variable, the result variable will not get updated. Is this a bug? There's a variable simple workaround (write to a different result variable, then update the original variable in a tasker 'variable set' action), but just thought I'd point it out as it seems like quite a common use case.

    Thanks!
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,477
    Likes Received:
    806
    Hi. I tried this and it worked for me.

    Can you please export your task's description (not xml) so I can take a look? Long-click the task in Tasker->export description Thanks in advance
     
  3. obscurereference

    obscurereference New Member

    Joined:
    Mar 6, 2015
    Messages:
    24
    Likes Received:
    1
    Ok, here's the task. Doesn't seem to be showing in the description, but the 'Result Json' variable in both actions is '%fruitdb':

    Json Test (369)
    A1: AutoTools Json Write [ Configuration:Separator: ,
    Add to Array Key: fruitbowl
    Array Object Keys: fruit,colour
    Array Object Values: apple,banana|red,yellow
    Arrays Separator: | Timeout (Seconds):60 ]
    A2: Flash [ Text:%fruitdb Long:Off ]
    A3: AutoTools Json Write [ Configuration:Separator: ,
    Json Input: %fruitdb
    Update Fields: colour
    Update Values: green
    Filter Field: fruitbowl.fruit
    Filter Value: apple
    Case Insensitive: true
    Arrays Separator: | Timeout (Seconds):60 ]
    A4: Flash [ Text:%fruitdb Long:Off ]
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,477
    Likes Received:
    806
    Did you use % in the output variable? :) You shouldn't...
     
  5. obscurereference

    obscurereference New Member

    Joined:
    Mar 6, 2015
    Messages:
    24
    Likes Received:
    1
    Ok, removing the % worked. On the dialog that pops up when you click 'Json Result Variable', there's a tasker variable picker and that keeps the % there when a variable is picked. That and the fact that a % is required when selecting an input variable is why I assumed it was supposed to be there .

    Thanks for the quick response!
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,477
    Likes Received:
    806
    If you use the % there, that'll make Tasker replace the value with whatever the contents of the variable is :) So, in reality you were setting the output variable name to the whole Json input :D

    Glad it works!
     

Share This Page