simply, set a form as insert or update mode?

hi guys, this might sound stupid, but drove me nuts since this morning, i had old project in sc7, that has multiple records form, by chance, i want to work on some records only in update mode… so it really doing that, i didn’t do anything… i set the records to insert 0 - that was it… everytime the form is loaded, it shows the records in update mode… that is fine

now in sc8 ican’t make it start by editing mode! i just want to start in update mode so to show me specefic records in the databae (defined by SQL part) but still shows fields in insert mode… I search in the forum and went through the settings of this sc8 but maybe i am overlooking something, i know it may sound stupid or easy??

any hint??

Mike

A form is always displayed in update mode by default. if you want to change that you need to define insert mode by using a macro ** in another progra ** i.e. the menu on execute event. Sometimes removing buttons can help, i.e. if you remove insert button then the form is update mode only.

i did that Albert, keep working in insert mode with 10 empaty records… if i make the records to insert 0 then it gives me 1 record to insert… i have 10 records in the database i just want to load the form with that data!! seems crazy

There is a macro that will do this (see “start” property):

sc_apl_conf(“Application”, “Property”, “Value”)

This macro allows to modify the property of the application. The user can determine if a Form will start in insert mode, or a Grid starts by filter, etc.

This macro must be used by one application to modify the properties of another application.

Properties for Form applications

Property	Value	        Description

start	                new	        Forces the form to start in the insert mode in order to add new records.
insert	                on/off	Qualifies (on) or unqualifies (off) the "add new" button to allow the addtion of new records.
update               on/off	Qualifies (on) or unqualifies (off) the "save" button on the form.
delete                on/off	Qualifies (on) or unqualifies (off) the "delete" button on the form.
field_display_off	field	        Dinamically hides a field.
field_display_on	field	        Dinamically shows a field.
field_readonly	field	        Dinamically set the "readonly" attribute in order to select the field.
rows		                        Forces the number of lines for each page (only for form of multiple records).
rows_ins		                Forces the number of lines for insert (only for form of multiple records).

hi again guys, you are right, i think it is moody, sometimes the button changes its behavior! i don’t understand why sc guys don’t make clear open in settings to make it open in edit or insert mode! it is so wanted and essential! anyway, it is manageable i think

I think SC team thought deep about what makes insert mode an insert mode. and this is the empty form with the Insert button :slight_smile:
by the way , often you do not want insert button on your forms because it will confuse the users. there will be two buttons update and add new next to each other.
if you remove insert button from the toolbar the button Add New will disappear and you end up with a nice looking form where only one button - submit or whatever.
Once the user insert new records you can add own flow.

If you start form with start new macro, it won’t add the insert button, so you have to run an extra macro to enable the button.
example for menu item on execute :
if ({sc_menu_item} == “item_47”)
{
sc_apl_conf(“check_form”,“start”,“new”); // it will make sure the form opens empty
sc_apl_conf(“check_form”,“insert”,“on”); // it will make sure the button Insert is visible

final remark
technically we are inserting or updating a record, but the form should have just one button Submit from the user point of view.
(you can edit text for insert and update buttons and make it = Submit)

}