Page 1 of 1

Add calculated column to remote databook

PostPosted: Mon Sep 07, 2020 11:02 am
by Davidge
Hi,

is it possible to create a java site calculated column in a remote databook?

Thanks
Marco

Re: Add calculated column to remote databook

PostPosted: Mon Sep 07, 2020 12:07 pm
by Support@SIB
Yes, it's possible to add columns which are only available in-memory. It's also possible disable write-back feature for single columns..

You have different options:

Add the column to the databook, e.g.

Code: Select all
//before book.open();
book.getRowDefinition().addColumnDefinition(new ColumnDefinition("MYCOL",
                                            new ObjectDataType()));

Use the right datatype, e.g. StringDataType, BigDecimalDataType, ...

Fill the values with a custom row calculator:

Code: Select all
book.setRowCalculator(IRowCalculator)


The other option is that you define a column on server-side. The advantage is that such column will be sent automatically back to the server/storage. This doesn't mean that the column will be used for database operations.

The server-code:

Code: Select all
storage.getMetaData().addColumnMetaData(new ColumnMetaData("MYCOL",
                                        BigDecimalDataType.TYPE_IDENTIFIER));
         
storage.eventCalculateRow().addListener(...);