Runtime check if field has auto enter

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Runtime check if field has auto enter

Postby developers10 » Fri May 12, 2017 12:14 pm

Hi,

How can i see in runtime if a field has a Auto enter defined using metadata?
I have a function which checks for required (non nullable) fields but I want to exclude fields with auto enter.

Thx
developers10
 
Posts: 31
Joined: Thu Feb 23, 2017 5:33 pm

Re: Runtime check if field has auto enter

Postby Bernd.N » Fri May 12, 2017 1:02 pm

When I understand you right, I do not see the necessity of this.
Because when there are auto enter fields, those fields get values anyway, so checking required fields can also check those autoenter fields without harm.

We do the complete autoenter task with own sourcecode that runs when a new record gets created.
The advantage is that we can use the if-condition where necessary, and we have a better overview over those fields.
Also those fields will get found by a global search for a field name, which is also of value in some cases.

Additionally we use an own meta table to create autoenter values for specific tenants.
So when a customer wants a field always with a specific value at once, that is possible only for that customer.
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 474
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Re: Runtime check if field has auto enter

Postby developers10 » Fri May 12, 2017 1:13 pm

Hi Bernd,

Your system seems more efficient.
Problem is that I have to verify an Import-source where those auto-enter fields may or may not exist.
So I have to give the warning 'value for required field missing" in quite an early stage, before creating the records.
That's why I need to figure out if a value is missing for a non- auto enter field.
developers10
 
Posts: 31
Joined: Thu Feb 23, 2017 5:33 pm

Re: Runtime check if field has auto enter

Postby Bernd.N » Fri May 12, 2017 2:21 pm

Here is listed that there are those properties available:
https://wiki.servoy.com/display/public/DOCS/ColumnInfo

However I can not see how they can be retrieved.
If nobody else can tell a function for this, you could check the format of the Servoy repository and retrieve that information from there directly.
Because it should be inside there.
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 474
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Re: Runtime check if field has auto enter

Postby developers10 » Tue May 16, 2017 9:07 am

In the end, I resolved it by issuing newRecord and checking the import-data with the newRecord values.
And ofcourse clearing the foudnset so the dummy- newrecord wasn't saved.
Would be great if Servoy provided the ability to work with nested transactions, then I could simply issue a rollback on my newRecord.

Thx
developers10
 
Posts: 31
Joined: Thu Feb 23, 2017 5:33 pm

Re: Runtime check if field has auto enter

Postby ROCLASI » Tue May 16, 2017 9:38 am

developers10 wrote:Would be great if Servoy provided the ability to work with nested transactions, then I could simply issue a rollback on my newRecord.

You could simply delete the record from the foundset. If it was already saved it deletes it from the database, if it wasn't it just gets removed from the in-memory foundset. No real need for nested transactions there.
Or am I missing a use-case here where you really need nested transactions for this?
Robert Ivens
ROCLASI Software Solutions / JBS Group, Partner
SAN Developer / Servoy Valued Professional / Servoy Certified Developer
Twitter: @roclasi / @servoyforge
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5205
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Runtime check if field has auto enter

Postby developers10 » Tue May 16, 2017 10:24 am

Hi Robert,

Ofcourse, you are right, that's also what I do, but I just don't like this methodology.
One should be able to either create a new record which doesn't get saved automatically or have the ability to isolate certain operations in it's own transaction.
developers10
 
Posts: 31
Joined: Thu Feb 23, 2017 5:33 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: joe26 and 7 guests