AutoTools Need Help with variable in variable as JSON read string

Discussion in 'AutoApps' started by Greg Williams, Mar 8, 2017.

  1. Greg Williams

    Greg Williams New Member

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    I have a JSON query where the item and store are variables which h are set within my task. I have this string set as a variable, and that variable is set in the JSON string field within autotools JSON read.

    %QueryVariable=Sometext%var1Somemoretext%var2
    %var1=12345
    %var2=98765

    In my JSON read string I use %QueryVariable
    What I expected to be passed to the query was
    Sometext12345Somemoretext98765

    Instead what's being sent is
    Sometext%var1Somemoretext%var2 which causes the query to fail

    It's like the JSON string field is escaping the inner variables
    .Is this intended functionality? Any suggestions on how I approach the problem?
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    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. Greg Williams

    Greg Williams New Member

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    Item Json Query (8)
    A1: Variable Clear [ Name:%QueryStoreName Pattern Matching:Off ]
    A2: Variable Clear [ Name:%QueryStoreNumber Pattern Matching:Off ]
    A3: Variable Clear [ Name:%QueryItem* Pattern Matching:On ]
    A4: Variable Set [ Name:%QueryStoreName To:walmarthighland Recurse Variables:Off Do Maths:Off Append:Off ]
    <Fetch store number from db>
    A5: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBpath1 'select store_number from store_info where store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A6: Variable Set [ Name:%QueryStoreNumber To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A7: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] If [ %QueryStoreNumber Set ]
    A8: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch query info from db>
    A9: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select query from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A10: Variable Set [ Name:%QueryStoreQuery To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A11: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch Item id from db>
    A12: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itemidjson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A13: Variable Set [ Name:%QueryItemidJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A14: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch item price from db>
    A15: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itempricejson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A16: Variable Set [ Name:%QueryItempriceJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A17: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch Item Image from db>
    A18: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itemimagejson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A19: Variable Set [ Name:%QueryItemimageJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A20: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch item store from db>
    A21: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itemstorejson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A22: Variable Set [ Name:%QueryItemstoreJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A23: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch item status from db>
    A24: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itemstatusjson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A25: Variable Set [ Name:%QueryItemstatusJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A26: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch item aisle from db>
    A27: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itemaislejson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A28: Variable Set [ Name:%QueryItemaisleJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A29: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch item section from db>
    A30: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itemsectionjson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A31: Variable Set [ Name:%QueryItemsectionJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A32: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch item onhand from db>
    A33: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itemonhandjson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A34: Variable Set [ Name:%QueryItemonhandJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A35: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch item description from db>
    A36: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itemdescjson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A37: Variable Set [ Name:%QueryItemdescJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A38: Variable Clear [ Name:%dbreturn Pattern Matching:Off ]
    <Fetch item department from db>
    A39: Tasker SQLite Plugin [ Configuration:%dbreturn: The data returned from your sql statement
    %dbrows(): An array of rows returned from your sql statment
    %dbreturncount: The number of rows returned
    %dbcolumnname(): An array of values for each column (replace columnname with the actual column name)
    %dberr: The error message (if any)

    SQLite command: sqlite %DBPath1 'select itemdeptjson from stores join store_info as si on si.store_assoc=stores.store_assoc where si.store_name='%QueryStoreName'' Timeout (Seconds):10 ]
    A40: Variable Set [ Name:%QueryItemdeptJson To:%dbreturn Recurse Variables:Off Do Maths:Off Append:Off ]
    A41: Array Set [ Variable Array:%QueryJsonFields Values:%QueryItemidJson,%QueryItemimageJson,%QueryItemstoreJson,%QueryItemstatusJson,%QueryItemaisleJson,%QueryItemsectionJson,%QueryItemonhandJson,%QueryItemdescJson,%QueryItemdeptJson Splitter: ]
    A42: Popup [ Title: Text:%QueryStoreQuery Background Image: Layout:popup Timeout (Seconds):5 Show Over Keyguard:On ]
    A43: AutoTools Json Read [ Configuration:Json: %QueryStoreQuery
    Fields: %QueryJsonFields()
    Separator: , Timeout (Seconds):60 ]
     
  4. Greg Williams

    Greg Williams New Member

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    As an additional note, the array used in the JSON fields section works fine, as it evaluates each variable correctly within the list and passes the field names I had fetched from my DB.
     
  5. Greg Williams

    Greg Williams New Member

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    Any suggestions jao?
     
  6. Greg Williams

    Greg Williams New Member

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    Was there anything else I needed to provide?
     

Share This Page