Unable to stop the Race conditions in a process model

 When I select the items in the grid and click on the button in the background the process model should trigger, and it must complete successfully, But when I click the button instantly twice or thrice immediately another process model is triggering the items which have selected becomes duplicate in next section. So, Here race condition occurs. Actually, we tried to restrict that button not to click it a second time by the user. The problem is before writing to the DB by the first process model in the fraction of seconds processes model also. In the interface, we are passing the selected items through the start process and try to capture the output. But nothing works. Let me know is there any way to stop the race condition either in an interfcae or process model

  Discussion posts and replies are publicly visible

Parents
  • To start us off here, why is a process model required to write data to the DB on a button click while the interface is still active?  If this is a requirement, note utilizing a!writeToDataStoreEntity() on the button click instead is much lighter and much easier to control.  

    Additionally, if you set a flag on the button click, users should only be able to click once - potentially reset the flag to false if any data is modified that might need to be persisted to the DB?  Otherwise if you can post more details about your configuration and use case, that would assist here.

    a!localVariables(
      local!buttonClicked: false,
      
      {
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Write Data",
              value: true,
              disabled: local!buttonClicked,
              saveInto: {
                local!buttonClicked,
                a!writeToDataStoreEntity(
                  dataStoreEntity: cons!COE_DS_TESTING,
                  valueToStore: 'type!{urn:com:gdit:types}COE_TESTING'(data: "test")
                )
              }
            )
          }
        )
      }
    )

Reply
  • To start us off here, why is a process model required to write data to the DB on a button click while the interface is still active?  If this is a requirement, note utilizing a!writeToDataStoreEntity() on the button click instead is much lighter and much easier to control.  

    Additionally, if you set a flag on the button click, users should only be able to click once - potentially reset the flag to false if any data is modified that might need to be persisted to the DB?  Otherwise if you can post more details about your configuration and use case, that would assist here.

    a!localVariables(
      local!buttonClicked: false,
      
      {
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Write Data",
              value: true,
              disabled: local!buttonClicked,
              saveInto: {
                local!buttonClicked,
                a!writeToDataStoreEntity(
                  dataStoreEntity: cons!COE_DS_TESTING,
                  valueToStore: 'type!{urn:com:gdit:types}COE_TESTING'(data: "test")
                )
              }
            )
          }
        )
      }
    )

Children
No Data