Solved

Is it possible to define a filter value like a default value

  • 1 December 2021
  • 5 replies
  • 45 views

Userlevel 2
Badge +3

I'd like to define a default filter value for a field. This value depends on a selected row in a table.

Is therefor aa possibility in the software factory? I'm working with the installation 2021.3

Thanks in advance

icon

Best answer by Erwin Ekkel 3 December 2021, 09:23

View original

5 replies

Userlevel 5
Badge +9

Do you mean setting a default value on the filter based on the current row? 
 


That’s not possible to do. Can you explain why you want this functionality? Would it not be easier to create some prefilters? 

Userlevel 2
Badge +3

I want to filter on articles that have been sawn. The thickness will depend on the thickness of the raw material. Thicknesses can only be reduced. Then I only want to see articles with a thickness less than or equal to the thickness of the raw material. I can't do that with prefilters as far as I know.

Userlevel 5
Badge +9

Is this what you mean? I created a task that activates a filter based on the JJJ column and filters all rows equal to or smaller than JJJ’s value. 

 

 

Userlevel 2
Badge +3

This could probably do the job. The filter is on a lookup. Can you send me the code for the task in your example?

Userlevel 5
Badge +9

This how I did it (there’s probably more ways to achieve this): 

I created a table with two columns username, filter value. On executing the task the current row value is written to the table with the current user_id. If you want to use this concept on multiple tables then you should addd tablename to the filter table. The basic flow looks like this: 
 

In the Task I set the value to the filter table(I did an update since the value already exists but for your code a delete and insert would work):
 



Then in the preftiler I use query with the filtervalue from the filtertable, for the current user. 

 

Reply