Assign number from another field to min/max of range field

Hello! In an old thread it was mentioned that using the query language to assign a min / max value in a range field doesn’t work with dates. But is it possible with numbers?

I have a gallery where I choose a number of columns via range field on the gallery page blueprint.

columns:
  label: Number of columns
  type: range
  step: 1
  min: 1
  max: 5

I also have a range field on each gallery file blueprint to pick a number for column start and end.

columnEnd:
  label: Column end
  type: range
  min: 1
  max: "{{file.parent.columns.toInt}}"

It would be very cool if I could just assign the chosen number from the gallery field to the max value in the file range field, however that doesn’t seem to work.

Any other way to do this?

Unfortunately, the query language doesn’t work everywhere.

The only workaround that I can currently think of is to set the max value to your absolute max (5), but then use a before hook to check that the value is in fact not higher that what is selected. Not ideal.

Or use a different field type (select, checkboxes) where you can fill the options dynamically from the page data (using a route).

Thank you! I will use another field. However it would be nice if some day in the future this would be working with range fields as well :slight_smile: Checkboxes and selects are great for text-based content, but sliders would come very handy for visual adjustments of layout or spacing directly from the panel.