diff --git a/app/configurator/components/field.tsx b/app/configurator/components/field.tsx
index 09c9ee11c..682fd0fcb 100644
--- a/app/configurator/components/field.tsx
+++ b/app/configurator/components/field.tsx
@@ -80,6 +80,7 @@ import {
HierarchyValue,
ObservationValue,
TemporalDimension,
+ isTemporalOrdinalDimension,
} from "@/domain/data";
import { useTimeFormatLocale } from "@/formatters";
import { TimeUnit } from "@/graphql/query-hooks";
@@ -240,11 +241,56 @@ export const DataFilterSelect = ({
);
}
+ const canUseMostRecentValue = isTemporalOrdinalDimension(dimension);
+ const usesMostRecentValue = isDynamicMaxValue(fieldProps.value);
+ const maxValue = sortedValues[sortedValues.length - 1].value;
+
return (
}
- disabled={disabled}
+ label={
+ canUseMostRecentValue ? (
+
+
+
+
+ fieldProps.onChange({
+ target: {
+ value: usesMostRecentValue
+ ? `${maxValue}`
+ : VISUALIZE_MAX_VALUE,
+ },
+ })
+ }
+ />
+ }
+ label={
+
+
+ Use most recent
+
+
+ }
+ sx={{ mr: 0 }}
+ />
+
+
+ ) : (
+
+ )
+ }
+ disabled={disabled || usesMostRecentValue}
options={allValues}
sortOptions={false}
controls={controls}
@@ -253,6 +299,7 @@ export const DataFilterSelect = ({
onOpen={handleOpen}
loading={loading}
{...fieldProps}
+ value={usesMostRecentValue ? maxValue : fieldProps.value}
/>
);
};
@@ -349,7 +396,6 @@ export const DataFilterTemporal = (props: DataFilterTemporalProps) => {
}
/>
- {/* FIXME: adapt to design */}
?hasEnd .
+ ?value ${ns.schema.position} ?position .
+ }
${getQueryFilters(filterList, cube, dimensionIri?.value)}
- `.prologue`${pragmas}`;
+ `
+ .ORDER()
+ .BY(RDF.variable("hasEnd"), true)
+ .THEN.BY(RDF.variable("value"), true)
+ .THEN.BY(RDF.variable("position"), true)
+ .LIMIT(1).prologue`${pragmas}`;
let result: Array = [];