Skip to main content
February 29, 2024
Question

Ideas on creating process for importing excel data to database

  • February 29, 2024
  • 7 replies
  • 0 views

Hi,

I am working on a task where the main function is importing excel data to the database. 
I need to create an interface where I upload the excel file and the file gets saved somewhere in the directory, I did this by simply adding a file upload section which contains this code:

a!sectionLayout(
  label: "Upload Employee File",
  contents: {
    a!fileUploadField(
      label: "File Upload",
      labelPosition: "ABOVE",
      value: ri!document,
      saveInto: ri!document,
      target: cons!HR_EmployeeDataPointer,
      maxSelections: 1
    )
  }
)


Now, I need to create a process model where first I get the data from this uploaded file, query and match the data in the database and check if the employee exists and if it doesn't I need to update the database or leave it as it is if it exists. After these I need to show all the data in a grid in another interface.
Besides the first interface I also created the expression rule to read through the excel file even though it's still not finished yet. It has this code which goes through the uuid field.
if(
  a!isNullOrEmpty(ri!document),
  {},
  a!localVariables(
    local!data: readexcelsheetpaging(ri!document, 0, a!pagingInfo(1, 5000)),
    local!onlyData: index(local!data, "data", null),
    local!employeeData: a!forEach(
      items: local!onlyData,
      expression: 'recordType!{SYSTEM_RECORD_TYPE_USER}User'(
        'recordType!{SYSTEM_RECORD_TYPE_USER}User.fields.{SYSTEM_RECORD_TYPE_USER_FIELD_uuid}uuid': index(fv!item.values, 1, null)
      )
    ),
    local!employeeData
  )
)


Now, some ideas or advice on creating the process model would be helpful because that's where I am kind of stuck

7 replies

stefanhelzle0001
February 29, 2024

Can you share more details about the problem you have with the process model?

February 29, 2024

Yeah, so far I've added an user input task where the interface is referenced, 

I am having problems with referencing the expression rule in the script task and getting the data from there, as you can see the process is still not finished but I am looking more for ideas or advice on how could this process be implemented

stefanhelzle0001
February 29, 2024

What problems do you face here?

problems with referencing the expression rule in the script task