I have two tables: [see image beloW]
- HAK where the Column "Volumenstrom_h" has the input value ( x ) needed for the linear interpolation formula displayed which can be seen surrounded by the black border
- RohrdimensionierungsTabelle ( table with no geometry ) hosting the rest of needed variables for the formula.
Example of formula at work: For the first value "3573" from the table "HAK" we need the next smallest and next biggest value from the RohrdimensionierungsTabelle. For this step I managed to write an expression and get the X1 (3240) and X2 (3600) values.
/* X1 aka Xmin = 3240 */
with_variable(
'Vstrom',
"Volumenstrom_h",
array_max(array_filter(aggregate(
layer:='RohrdimensionierungsTabelle',
aggregate:='array_agg',
expression:="Volumenstrom [h]" ),
@element < @Vstrom))
)
and
/* X2 aka. Xmax = 3600 */
with_variable(
'Vstrom',
"Volumenstrom_h",
array_max(array_filter(aggregate(
layer:='RohrdimensionierungsTabelle',
aggregate:='array_agg',
expression:="Volumenstrom [h]" ),
@element < @Vstrom))
)
Next for finding the Y2 and Y2 I need to look in the RohrdimensionierungsTabelle at the index (@row_number) of X1 and X2 and then shift to the next column untill the values are ≤ 250. In the example above: Y1 (111,4) and Y2 (134,9). Here is the part where I need help.
Breaking it down:
1.First I need to get the index for the X2 and X1 from the RohrdimensionierungsTabelle.
2.Then get the values Y2 and Y1 at the index positon from the step 1 for the first Column ( 25 x 2,3 [Pa/m] ) and wrap it in a if statement checking if the values are smaller/equal to 250. If not check for the next Column and so on.
3.I think it would be more elegant if I would have another index for calling the columns by their position in the array an not by their name.
In Summary: I am looking for a expression in the HAK table where i can get all the values ( X1,X2,Y1,Y2) from the RohrdimensionierungsTabelle for each value x in the column "Volumenstrom_h"


