Screen and Fields with no datasource

Dear All,

What is the best way to create a screen that is not linked to a datasource or to a backend physical screen?
In other terms, I need to create an “run billing input” screen that captures parameters from the user and then generates invoices accordingly. The actual parameters are not linked to a datasource or table.

I have tried to create a UI without creating an entity, and built the xml file manually.
However, I am getting the following error:
GuiDevelopmentException: Datasource is not defined for FieldGroup field ‘fromDate’. Only custom fields can have no datasource.

Please advise on the best approach to achieve this.

Shady

Thank you. It worked by creating a non-persistent entity.

FieldGroup component cannot work without a datasource. So you should either use individual components like TextField, LookupField, etc., or create a non-persistent entity and use FieldGroup with a datasource containing this entity.

You can try using a @Transient fields

Will listeners such as “addItemPropertyChangeListener” work on fields belonging to non-persistent entities?

I need to display some message when the user key in some values in some fields. So as I used to do with persistent entities, I am overriding the method postInit() and the code is something like:

runBillingDs.addItemPropertyChangeListener(e -> {
if (e.getProperty().equals(“customerGroup”)) {
etc…

However, the debugger never goes into the listener or the if statement.

Any idea?

Shady

Yes the listeners should work for non-persistent entities in the same way as for persistent. Could you provide a sample project demonstrating the issue?

Hi Konstantin,

Please find attached:

  • RunBilling.java (the non-persistent entity class)
  • RunBillingEdit.java (the screen controller and its xml file)

I need to load the FromDate field based on the customer group chosen. The debugger would go into the postInit() method only the first time the screen loads (in which case customer group is null), then when I change the value of customer group, the method is not trigered.

Thanks in advance.

RunBilling.java (1.3K)

RunBillingEdit.java (7.0K)

run-billing-edit.xml (1.8K)

Hi Shady,

I couldn’t find the cause in your source code - it’s just too complex for me :slight_smile:

Could you create a small sample project with minimal code demonstrating the issue?