Solved

Starting a task with the name of the field that has focus as a paramer

  • 3 May 2023
  • 7 replies
  • 100 views

Badge

Working on a generic task that needs the name of the current field (and table).

Was looking for something like ‘cursor_to_col_id’, but that doesn't seem to be available in a (table) task

 

Am I overlooking something?

icon

Best answer by Mark Jongeling 25 July 2023, 13:29

View original

This topic has been closed for comments

7 replies

Userlevel 7
Badge +23

Hi Bas,

Table tasks are row-based procedures. The selected column on a row cannot be communicated to the task. 

One step back, what are you trying to accomplish? Maybe there's an alternative solution possible.

Badge

... 

One step back, what are you trying to accomplish? Maybe there's an alternative solution possible.

 

Hi Mark,

 

I'm working on extracting data from (email-)messages, based on markers in the (body)text, and creating a to-do list item.

 

It is possible to add and/or modify elements and markers, after a to-do list item has been made. So I want to be able to re-run the data extraction for one field (of choice) of one to-do list item. 

My idea is that by starting a (table) task, that 'knows’ what field (on screen) focus, by passing that field name as a parameter, I can determine the element by doing a lookup on [element].[mapped to ..], and be true to low-code ;) 

This way one task will suffice.

I wouldn't want to have to make a task per field, or bothering the end-user with a dialogue window that needs user input, when the context is clear already.

 

high-over data model:

[element] → [marker settings]

 

[element]

  • name
  • mapped to table
  • mapped to column

[marker settings]

  • language
  • BoL [CR/CR+LF/LF]
  • start marker
  • end marker
  • EoL [CR/CR+LF/LF]

 

 

Userlevel 7
Badge +23

Hi Bas,

It is not possible to execute task with the context of the selected column, only from the selected row(s). That would mean the task pop-up will need a field to specify which column has to be passed onto the Task. Feel free to create an Idea for that.

For creating a task parameter and populating it with all visible columns, you can create a View that gets a record for each of the visible grid column using SQL-typed Control procedures. The template looks like this:

select c.col_id
from (
values
('[COLUMN]'),
(null)
) c(col_id)
where c.col_id is not null

In the Control procedure code, assign the template once by inserting a record into #prog_object_item and replacing the parameter with the column values like so:

-- Available variables
-- @model_id - Name of the current model
-- @branch_id - Name of the current branch
-- @control_proc_id - Name of the current control procedure

insert into #prog_object_item
(
prog_object_id,
prog_object_item_id,
order_no,
template_id
)
select
'view_example', -- < replace "example" with correct view name
@control_proc_id,
10,
@control_proc_id

insert into #prog_object_item_parmtr
(
prog_object_id,
prog_object_item_id,
parmtr_id,
parmtr_value,
order_no,
no_line_when_empty
)
select
'view_example', -- < replace "example" with correct view name
@control_proc_id,
'COLUMN',
col_id,
c.abs_order_no,
0
from col c
where c.model_id = @model_id
and c.branch_id = @branch_id
and c.tab_id = 'example' -- < replace "example" with correct table name
and coalesce(c.grid_type_of_col, c.type_of_col) = 0 -- Editable in Grid

Or else (less mutable), you could write a Dynamic model procedure that obtains all visible columns in said grid, then create a domain with elements, one element for each field. For each new element that now has no translation, you can obtain the translation of the grid column and reuse that for the domain element, so the translation of both the column and the element are the same.

Hope this helps!

Badge

Thank you for your extensive reply Mark.

 

We may use that in a different issue, but for now it doesn't really fit the process(flow) I have in mind, as it adds an extra step in the process.

 

I'm looking into an option where I use a hidden field to store the name of the field that has focus. And maintain that using the default 'trigger’ and @cursor_from_col_id/@cursor_to_col_id. Then the task (parameters) can use that hidden field, and no user input is needed.

Userlevel 5
Badge +8

Hi @BasWesselink,

Good to read that Mark's reply may be an option for upcoming situations. Did the option you tried for now work? In that case I will close this topic :)

No, unfortunately it did not.


For now, is doesn't seem to be possible to hook into the data that is used for the <alt>+<F1> - location functionality

Maybe this functionality can be made publicly available in a future version?

Userlevel 7
Badge +23

No, unfortunately it did not.


For now, is doesn't seem to be possible to hook into the data that is used for the <alt>+<F1> - location functionality

Maybe this functionality can be made publicly available in a future version?

Currently Tasks are row-based actions and even though the GUI may know which column is selected by the user, it cannot be used to provide the name to the Task parameter.

Perhaps we could implement a similar feature to Report properties, by having Task properties. One of those properties could be Selected column which would be filled with the col_id of the selected column by the user. But, there could be an even better way. Feel free to create an Idea for this.