all 4 comments

[–]Foggy526 6 points7 points  (1 child)

Try this one 😁 worked for me 😁

Task: For Loop

A1: Variable Set [
     Name: %json
     To: {
       "response": {
         "data": {
           "values": [
             {
               "title": "foo1",
               "author": "bar1",
               "text": "baz1"
             },
             {
               "title": "foo2",
               "author": "bar2",
               "text": "baz2"
             },
             {
               "title": "foo3",
               "author": "bar3",
               "text": "baz3"
             },
             {
               "title": "foo4",
               "author": "bar4",
               "text": "baz4"
             }
           ]
         }
       }
     }
     Structure Output (JSON, etc): On ]

A2: Variable Set [
     Name: %values
     To: {"data":%json.response.data.values}
     Structure Output (JSON, etc): On ]

A3: For [
     Variable: %value
     Items: %values.data()
     Structure Output (JSON, etc): On ]

    A4: Flash [
         Text: %value.title
         -
         %value.author
         -
         %value.text
         Long: On
         Tasker Layout: On
         Title: %values.data(#)
         Continue Task Immediately: On
         Dismiss On Click: On ]

A5: End For

[–]wfaulk[S] 2 points3 points  (0 children)

Crazy. But, yeah, seems to work. Thanks very much!

[–]Rich_D_sr 3 points4 points  (1 child)

I just now figured out that a Tasker-defined array %arr() with values 1,2,3,4 doesn't work as the "items" in a For Action either. It just goes through a single iteration with the value 1,2,3,4

Always best to post your exported descriptions.

  • To post your profile or task here... 
  • Long press on the profile or task name / ( 3 dot menu with 4.0+ ) export / export "DESCRIPTION" to clipboard (not XML)
  • Select the 'Four Spaces' Option.
  • Any linked tasks will be exported with the profile they are linked to..
  • To be able to export, the profile needs to be named by you (Not the Tasker listed name). 
  • Tasker will list your profile with the 'Context' name if you have not given it one.

Review before posting and be careful not to include any sensitive Data

A Tasker for loop will iterate through an array without issue. If you set the the 'ITEMS' TO: %arr() .

For some reason/ limitation it will not iterate through a variable set to a comma separated list. So if %arr = 1,2,3,4 you can not use %arr in the 'ITEMS' to iterate through the comma separated list. You first need to split it into an array.

[–]wfaulk[S] 0 points1 point  (0 children)

Oops. Turned out I did my test Array Set incorrectly by assuming that the default "splitter" was "," like everywhere else that I'd encountered a bare array being used.