Custom Date Field "not Found"

Hello - I am new to Mockaroo, so I apologize if I’m missing a simple concept or my question is poorly worded.

I am creating pipeline data and trying to have a date for when each record was at a certain stage of the pipeline. Of course, the date for stage 1 can’t be later than the date for stage 2 and so on. Also, if a record is at a stage of ‘lost’, I want to be able to record the date it moved to ‘lost’ as well as what stage it was at before moving to ‘lost’ and the corresponding date. So I have included a ‘furthest_stage’ field to record the stage prior to ‘lost’.

My ‘new_record_date’ field is a datetime field that generates a date bt 1/1/2021 and today.

My ‘stage1_date’ field function is set up as follows:

if stage == 'stage1' then new_record_date + days(random(0,60))
elsif stage == 'stage2' then new_record_date + days(random(0,60))
elsif stage == 'stage3' then new_record_date + days(random(0,60))
elsif stage == 'won' then new_record_date + days(random(0,60))
elsif furthest_stage == 'stage1' then new_record_date + days(random(0,60))
elsif furthest_stage == 'stage2' then new_record_date + days(random(0,60))
elsif furthest_stage == 'stage3' then new_record_date + days(random(0,60))
else ' '
end

This does produce the intended output of a datetime (’%m/%d/%Y) for ‘stage1_date’. However, the issue I am running into is when I’m building ‘stage2_date’ referencing this first field.

if stage == 'stage2' then stage1_date + days(random(0,60))
elsif stage == 'stage3' then stage1_date + days(random(0,60))
elsif stage == 'won' then stage1_date + days(random(0,60))
elsif furthest_stage == 'stage2' then stage1_date + days(random(0,60))
elsif furthest_stage == 'stage3' then stage1_date + days(random(0,60))
else ' '
end

This is the error message I am getting: “error: Field ‘stage1_date’ not found”.

I have tried using field(‘stage1_date’) in the formula, as well as a .strptime() function and a combo of both - with the same error.

Apologies for the long message - appreciate any help that is available.

I figured it out - a dumb mistake on my part.

For others’ benefit, would you mind saying more about what the fix was?