SFDO-Tooling / Snowfakery

A tool for generating fake data that has relations between tables.
BSD 3-Clause "New" or "Revised" License
141 stars 32 forks source link

No iterators work in the context of for_each Dataset.iterate #1050

Open ozzieg opened 4 months ago

ozzieg commented 4 months ago

No counter works properly within the context of a "for_each" with a Dataset.iterate. It resets every single time so it never steps (NumberCounter) or goes up in date (Schedule.Event).

Here is a simple example where the "Counters.NumberCounter" and "Schedule.Event" date doesn't increment no matter what I do:

- object: Example
  for_each:
    var: sfts_object
    value:
      Dataset.iterate:
        dataset: csv-input/SFTSObject.csv
  fields:
    mycount:
      Counters.NumberCounter:
        start: 1
        step: 1000
    poop: ${{ mycount }}
    pooper: ${{ child_index }}
    sftsobject2: ${{ sfts_object.APIName }}
    stsfobjectId:
      reference: Example
    sftsobjectId2: ${{ sfts_object.Id }}
  friends:
    - object: Schedule
      nickname: snapshot_schedule
      count: 5
      fields:
        DateTime:
          Schedule.Event:
            start_date: 2022-01-01
            freq: weekly
      friends:
        - object: ExampleChild
          fields:
            nene: ${{ snapshot_schedule.DateTime }}
            kaka: ${{ Example.pooper }}
            shosho: ${{ Example.mycount }}