Create a button for number generator

  • 12 May 2020
  • 7 replies

Userlevel 5
Badge +13


I have a table with several fields. One of them being a number that is sometimes generated, sometimes entered manually. 

So next to this field I would like to have a button (with some code behind it..) that says ‘generate number’. However, I can’t find it or am looking in the wrong direction. 

Things tried;

  • made a combo-field. When selected manual; it does nothing. When selected ‘generate’ it generates the number. (works OK-ish, but wrong design)
  • Made a Task with a button, but this appears in the top left corner (next to Print icon). Will probably work, but wrong location


Anyone can point me in the right direction on this?


Much appreciated! 






Best answer by Anne Buit 26 May 2020, 15:19

View original

7 replies

Userlevel 5
Badge +8

Hello Alex,

How about a checkbox that is placed right after the number-field? You can set this up in ‘User interface’ > ‘Subjects’ > ‘Components’ > ‘Form’. When setting the “Field no. of positions further” for the checkbox-field to 0, it will appear right next to the number-field.

You then have to write some logic: when the checkbox is checked the number will be generated in the number-field, and after this the checkbox will be emptied directly.

With regards,

Jeroen van den Belt

Userlevel 5
Badge +13

Hi @Jeroen van den Belt ,


Thanks for thinking along! I already use quite a lot of checkbox for setting if the fields needs to be brought to the next screen. An extra checkbox with a different functionality might confuse the user. The dropdown might be a bit more user-friendly (gut feeling). 


I get the feeling that a simple button is not possible..? 


Userlevel 7
Badge +5

Hi Alex,

Placing a task button next to a field as you described is not possible at the moment. However, if you were to use a single radio button instead of a checkbox or combo you might achieve the desired user experience.

The Default logic resets the radio button to null when the value of the radio button field is changed and generates a random number.

You can set the form to default-editable if you want the user to be able to immediately use this functionality when opening the screen.

Userlevel 5
Badge +13

Hi Anne, 


Thanks for thinking along. This is an option, but it is decided that we are going to this with a Task (button top left) instead. So, it’s no longer needed. 

Perhaps you can help me with the next issue with this task. 

I have the task button, that generates the number based on the selected line. However, tasks do not work (if i’m correct) when in Edit-mode). When clicked, the number is generated and saved by Update-statement in the DB. All good. But the screen does not refresh after this, so the user won’t see the generated number; only if it is manually refreshed.


How can I force a screen update after the task? 



Userlevel 7
Badge +5

Is the task bound via a table-task to the lines or is it bound to a detail, parent or sibling subject?

And what is the refresh-after-execute setting currently set to for the table-task?

Userlevel 5
Badge +13

It was set to Document. Change to Subject. 
No effect.

When i turned 

“Await result”  from NO to YES. it does refresh. 

So, solved. 

(no idea what other effects are on No/Yes  for Await result..) 

Userlevel 7
Badge +5

Good to hear the solution has been found.

You can read more about this setting in the online documentation

Basically, this setting causes the task to execute in the background. The refresh after the execution will no longer trigger as the user can continue to perform other actions during task execution.