How can I insert a value into database?

Hello I would like to know how to insert data into a database, my database is called "oapedidos",

I have a constant created to perform the queries,

and a CDT.

I have an interface

in which I simply write the name of an order and its status, and a button to register that data "ALTA". I do not know how it should be done, I have seen in the forum that it is with a! WriteToDataStoreEntity (
dataStoreEntity: cons! DATA_STORE_ENTITY,
valueToStore: ri! rule_input) but I don't know how it works,

Do I have to create a rule input in the interface whose type is CDT??

the code of my interface is:

{
  a!sectionLayout(
    label: "Alta pedido",
    contents: {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!textField(
                label: "Referencia del pedido",
                labelPosition: "ABOVE",
                saveInto: ri!oapedidos.nombrepedido,
                refreshAfter: "UNFOCUS",
                validations: {}
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!textField(
                label: "Estado del pedido",
                labelPosition: "ABOVE",
                saveInto: ri!oapedidos.estadopedido,
                refreshAfter: "UNFOCUS",
                validations: {}
              )
            }
          )
        }
      )
    }
  ),
  a!buttonArrayLayout(
    buttons: {
      a!buttonWidget(
        label: "Alta",
        saveInto: a!writeToDataStoreEntity(
          dataStoreEntity: cons!GP_Pedido_Entity,
          valueToStore: ri!oapedidos),
        style: "NORMAL"
      )
    },
    align: "START"
  )
}

By the way how can I make refreshAfter: "UNFOCUS" be when I press the "ALTA" button?

forgive my ignorance I'm still learning,

greetings and thanks

  Discussion posts and replies are publicly visible

Parents Reply
  • Thanks for responding, now I see that the program works, I have been able to upload the data to the database but the problem is that when I write for example "A1021" in "Referencia del pedido" and "pending", the status of the order, the text that I have written is deleted, What I want is that the text remains until I press the "ALTA" button, then the text of those text boxes is deleted and the insertion is made to the database.

    Apart from that I cannot save this interface as a report because it says this."This interface may not be saved as a report because it has one or more inputs".

Children