Is it possible to setup a string with an sql INSERT command so I can create record in my database this way ?
Some times when you need to create records in a 3 or even 4 way relationship, it is much easier with sql rather than with the standard method with servoy.
You could do it by making a stored procedure in your database, to which you pass your insert statement, then the SP evaluates your string and executes it.
But, this insert will not be reflected in Servoy Client/Developer, untill you restart it.
I’m sure some other people on the forum will tell you it’s not so hard to do the same through Servoy
You cannot execute “raw” SQL statements (except for SELECT) in Servoy. The reason is because of client data consistency. If you did a delete or insert of tens or hundreds of records - how would Servoy “know” what records were affected? Answer - it wouldn’t - so you could wind up in a situation where a client was looking at invalid data.
Instead - use a stored procedure to insert records or you can also use a loop in Servoy and add the records that way as well.
Invaliditing cache can have enormous performance impact, imagine what would happen if you have 1000 users of your solution and you keep invaliditing theire entire cache all the time.
Why don’t you simply create a form on the table you want to insert to and create new records through that? It doesn’t matter at all how many relations away it is, you can address it directly. Aditionally that is also easier to code than INSERT statements and broadcasting and caching remains accurate.