Hello, ALL.
Can someone Just give me a step-by-step about How to insert data into a DB from a site?
I Just trying during ALL the day nd dont know How to do.
Discussion posts and replies are publicly visible
Hi,
If you have a specific issue regarding your form, please post it here and we can see if we can help.
In the meantime, for step by step instructions, feel free to check out the tutorials here: or the courses in Appian Academy.
If u can take a look at this Topic: Input Rule error on site
And have more tips, i really need help with this
That's still too broad. Would need to see the code to be able to help.
a!localVariables( local!currentEmployeeInformation: a!map( name: "", birthDate: "", streetAddress: "", city: "", uf: "", cepCode: "", country: "", phone: "", email: "" ), local!cancel, a!headerContentLayout( header: { a!cardLayout( contents: { a!columnsLayout( columns: { /* Form content */ a!columnLayout( contents: { a!columnsLayout( columns: { /* Empty column layouts on both sides * * help to center the content */ a!columnLayout(), a!columnLayout( contents: { a!sectionLayout( showWhen: not(a!isPageWidth("PHONE")), marginBelow: "EVEN_MORE" ), a!sectionLayout( label: "Registrar Usuário", labelIcon: "user", labelSize: "LARGE", labelColor: "STANDARD", contents: { a!localVariables( local!showEmployeeInformation: false, if( a!isPageWidth("PHONE"), { /* On phone widths, show employee information * * in an initially collapsed card */ a!richTextDisplayField(), a!cardLayout( contents: { a!sideBySideLayout( items: { a!sideBySideItem( item: a!stampField( labelPosition: "COLLAPSED", text: initials(local!currentEmployeeInformation.name), contentColor: "STANDARD", size: "TINY" ), width: "MINIMIZE" ), a!sideBySideItem( item: a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: local!currentEmployeeInformation.name, size: "MEDIUM" ), char(10), a!richTextItem( text: local!currentEmployeeInformation.role, size: "SMALL" ) } ) ), a!sideBySideItem( item: a!richTextDisplayField( value: a!richTextIcon( icon: if( local!showEmployeeInformation, "chevron-down", "chevron-right" ), size: "MEDIUM" ), align: "RIGHT" ) ) }, alignVertical: "MIDDLE" ) }, link: a!dynamicLink( value: not(local!showEmployeeInformation), saveInto: local!showEmployeeInformation ), style: "#f0f0f0", padding: "MORE", marginBelow: if( local!showEmployeeInformation, "NONE", "MORE" ), showBorder: false, accessibilityText: if( local!showEmployeeInformation, "Employee information displayed. Press enter to hide.", "Employee information hidden. Press enter to display." ) ), a!cardLayout( contents: { a!sectionLayout( label: upper("Current Address"), labelSize: "EXTRA_SMALL", labelColor: "STANDARD", contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { local!currentEmployeeInformation.streetAddress, char(10), local!currentEmployeeInformation.city, ", ", local!currentEmployeeInformation.state, " ", local!currentEmployeeInformation.zipCode, char(10), local!currentEmployeeInformation.country } ) }, marginBelow: "MORE" ), a!sectionLayout( label: upper("Contact Information"), labelSize: "EXTRA_SMALL", labelColor: "STANDARD", contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextIcon(icon: "phone"), " ", local!currentEmployeeInformation.phone } ), a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextIcon(icon: "envelope"), " ", local!currentEmployeeInformation.email } ) }, marginBelow: "NONE" ) }, showWhen: local!showEmployeeInformation, style: "#f0f0f0", padding: "MORE", marginBelow: "MORE", showBorder: false ) }, {} ) ), a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Username:", placeholder: "Informe seu nome...", value: local!currentEmployeeInformation.name, saveInto: local!currentEmployeeInformation.name, refreshAfter: "KEYPRESS" ) } ), a!columnLayout(contents: { a!dateField( label: "Birth Date:", labelPosition: "ABOVE", value: { local!currentEmployeeInformation.birthDate }, saveInto: { local!currentEmployeeInformation.birthDate }, validations: {} ) }) }, alignVertical: "MIDDLE", marginBelow: "LESS", spacing: "DENSE", stackWhen: { "NEVER" }, showDividers: false ), a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Phone Number:", labelPosition: "ABOVE", placeholder: "Informe seu numero de contato...", value:{local!currentEmployeeInformation.phone}, saveInto: {local!currentEmployeeInformation.phone}, refreshAfter: "KEYPRESS", validations: {}, inputPurpose: "PHONE_NUMBER" ) } ), a!columnLayout( contents: { a!textField( label: "Email Address:", labelPosition: "ABOVE", placeholder: "Informe seu endereço de email...", value: {local!currentEmployeeInformation.email}, saveInto: {local!currentEmployeeInformation.email}, refreshAfter: "UNFOCUS", validations: {}, inputPurpose: "EMAIL" ) } ) }, alignVertical: "BOTTOM", spacing: "DENSE" ), a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "CEP:", placeholder: "Informe o CEP...", value: local!currentEmployeeInformation.cepCode, saveInto: { local!currentEmployeeInformation.cepCode, rule!UR_ViaCep( cep: local!currentEmployeeInformation.cepCode, onSuccess: { a!save( local!currentEmployeeInformation.streetAddress, fv!result.body.logradouro ), a!save( local!currentEmployeeInformation.city, fv!result.body.localidade ), a!save( local!currentEmployeeInformation.uf, fv!result.body.uf ) } ) } ) }, width: "1X" ), a!columnLayout( contents: { a!textField( label: "City", labelPosition: "ABOVE", placeholder: "Informe sua cidade...", value: {local!currentEmployeeInformation.city}, saveInto: {local!currentEmployeeInformation.city} ) } ), a!columnLayout( contents: { a!textField( label: "UF", labelPosition: "ABOVE", placeholder: "Informe a UF...", value: {local!currentEmployeeInformation.uf}, saveInto: {local!currentEmployeeInformation.uf} ) } ) }, marginBelow: "LESS", spacing: "DENSE", stackWhen: { "TABLET_PORTRAIT", "PHONE" } ), a!textField( label: "Street Address", labelPosition: "ABOVE", placeholder: "Informe seu logradouro...", value: { local!currentEmployeeInformation.streetAddress }, saveInto: { local!currentEmployeeInformation.streetAddress }, masked: false, inputPurpose: "STREET_ADDRESS" ) }, divider: "BELOW", dividerWeight: "THIN" ), a!columnsLayout( columns: { a!columnLayout( contents: { a!buttonArrayLayout( buttons: { a!buttonWidget( label: "Cancel", value: true, saveInto: {local!cancel}, submit: true ) }, align: "START" ) } ), a!columnLayout( contents: { a!buttonArrayLayout( buttons: { a!buttonWidget( label: "Update", submit: true, saveInto: { a!save('recordType!{72ef8a55-ad70-42ec-8a88-553c0470648d}UR_Reg'.name, local!currentEmployeeInformation.name) }, style: "PRIMARY") } ) } ) } ) }, width: "MEDIUM_PLUS" ), a!columnLayout() } ) } ), /* Additional details content */ a!columnLayout( contents: { a!cardLayout( contents: { a!sectionLayout(label: "", marginBelow: "MORE"), a!sectionLayout( label: upper("Preview"), labelSize: "EXTRA_SMALL", labelColor: "STANDARD", contents: { a!sideBySideLayout( items: { a!sideBySideItem( item: a!stampField( labelPosition: "COLLAPSED", text: initials(local!currentEmployeeInformation.name), contentColor: "STANDARD", size: "TINY" ), width: "MINIMIZE" ), a!sideBySideItem( item: a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: local!currentEmployeeInformation.name ), char(10), a!richTextItem( text: local!currentEmployeeInformation.birthDate, size: "SMALL" ) } ) ) }, alignVertical: "MIDDLE" ) }, marginBelow: "MORE" ), a!sectionLayout( label: upper("Current Address"), labelSize: "EXTRA_SMALL", labelColor: "STANDARD", contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { local!currentEmployeeInformation.streetAddress, char(10), local!currentEmployeeInformation.city, ", ", local!currentEmployeeInformation.uf, " ", local!currentEmployeeInformation.cepCode, char(10), local!currentEmployeeInformation.country } ) }, marginBelow: "MORE" ), a!sectionLayout( label: upper("Contact Information"), labelSize: "EXTRA_SMALL", labelColor: "STANDARD", contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { if(len(local!currentEmployeeInformation.phone)=10, {a!richTextIcon(icon: "phone"), " ", text(local!currentEmployeeInformation.phone, "(00) 0000-0000")}, if(len(local!currentEmployeeInformation.phone)=11, {a!richTextIcon(icon: "phone"), " ", text(local!currentEmployeeInformation.phone, "(00) 00000-0000")}, a!richTextIcon("phone"))) } ), a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextIcon(icon: "envelope"), " ", local!currentEmployeeInformation.email } ) } ), /* Use cards to create a side bar */ a!cardLayout( height: "EXTRA_TALL", style: "#f0f0f0", marginBelow: "STANDARD", showBorder: false ), a!cardLayout( height: "EXTRA_TALL", style: "#f0f0f0", marginBelow: "STANDARD", showBorder: false ) }, style: "#f0f0f0", padding: "MORE", marginBelow: "NONE", showBorder: false ) }, width: if( a!isPageWidth("TABLET_PORTRAIT"), "NARROW_PLUS", "MEDIUM" ), showWhen: not(a!isPageWidth("PHONE")) ) } ) }, padding: if( a!isPageWidth("PHONE"), "STANDARD", "NONE" ), marginBelow: "NONE", showBorder: false ) } ) )
You need to add the a!writeRecords smart service function in the submit button saveInto as shown in this example:
Really works, ty!