test12_multi_write_loop.json 984 B

12345678910111213141516171819202122232425262728293031323334353637
  1. {
  2. "version": "3.15",
  3. "name": "Test12: Loop with File Writes + .length",
  4. "registry": {
  5. "params": [],
  6. "vars": ["$files([OBJECT])", "$count(INT)"],
  7. "files": { "inputs": [], "artifacts": ["Output/*"] }
  8. },
  9. "steps": [
  10. {
  11. "id": "Set_Files",
  12. "target": "$files",
  13. "value": "[{\"name\": \"file_a\", \"body\": \"Content of file A\"}, {\"name\": \"file_b\", \"body\": \"Content of file B\"}, {\"name\": \"file_c\", \"body\": \"Content of file C\"}]",
  14. "next": "Loop_WriteFiles"
  15. },
  16. {
  17. "id": "Loop_WriteFiles",
  18. "mode": "parallel",
  19. "source": "=$files",
  20. "children": ["Write_OneFile"],
  21. "next": "Set_Count"
  22. },
  23. {
  24. "id": "Write_OneFile",
  25. "target": "=\"Output/\" + _item.name + \".txt\"",
  26. "value": "=_item.body",
  27. "next": "RETURN"
  28. },
  29. {
  30. "id": "Set_Count",
  31. "target": "$count",
  32. "value": "=$files.length",
  33. "next": "Stop_End"
  34. },
  35. { "id": "Stop_End" }
  36. ]
  37. }