Fill one field with custom list values if another field has a specific custom list value

I have a field ‘type’ with custom list values one of which is ‘success’. It also has other values.

I have another field ‘temp’ with custom list values ‘hot’, ‘cold’, ‘cool’, ‘warm’.

What I want is to ensure the field ‘temp’ has values from the custom list if the type ‘field’ has value ‘success’, else left blank

Similarly I have another field ‘temp value’ with number with min 19 and max 34 which should get filled if the type ‘field’ has value ‘success’, else left blank / 0.

Sincerely appreciate all help.

Thanks

You can set your temp field to a Custom distribution. Check out this schema for an example: Mockaroo - Random Data Generator and API Mocking Tool | JSON / CSV / SQL / Excel

1 Like

Thanks, I guess I can’t do anything as far as temp value field is concerned which has ‘Number’ as ‘Type’

I updated the schema with the additional field.

Thanks again. When I try to do this with json schema, does not seem to work.
I changed id, type, temp, etc. to app.id, app.status.type, app.data.temp etc and updated the codes.
The errors in preview I get is…

[{
  "app": {
    "id": 1,
    "status": {
      "type": "hello"
    },
    "data": {
      "temp": "error: Field 'app' not found",
      "temp_number": "error: Field 'app' not found"
    }
  }
}, {
  "app": {
    "id": 2,
    "status": {
      "type": "success"
    },
    "data": {
      "temp": "error: Field 'app' not found",
      "temp_number": "error: Field 'app' not found"
    }
  }
}

For any formula using a field with dot notation you must enclose in double-quotes.

“app.status.type”

https://mockaroo.com/4e689760

On data preview Mockaroo - Random Data Generator and API Mocking Tool | JSON / CSV / SQL / Excel, I get

{
  "app": {
    "id": 10,
    "status": {
      "type": "in-progress"
    },
    "data": {
      "temp": "",
      "temp_number": 0
    }
  }
}, {
  "app": {
    "id": 11,
    "status": {
      "type": "success"
    },
    "data": {
      "temp": "",
      "temp_number": 0
    }
  }
}

Check it out now. Forgot I needed to do this on the app.data.temp field