Feedback Message to records upload from a Excel

Feedback Message to records upload from a Excel

  

Hi Guys!


I'm developing a system to the HR of my company.

The end-users asked for a little improvement in one of the services that this system offers.

Here is the deal:

We have a table with all the employees of the company and this table can be populated with a Excel file. This service is working pretty well, it checks if the employee is already in the table, and if it is, do a update, else it do a create (used a CreateOrUpdate action). But what was asked is this: After the end-user do send the file and the list is populated, the user want to know how many registers will be updated and how many registers will be created. 


I tried to use a For Each record + ListIndexOf with the condition if registration is already present in the table + If Position (Output of the ListIndexOf) = -1 then add +1 in the local variable "Created" else add +1 in the variable "Updated".

But the ListIndexOf can't be used inside de for each, i have this error message: "Attempting use IndexOf on a list while it's being iterated".


Which other way I can explore to attend this demand?


Regards,

Diego.
 

Solution

Hi there Diego.

Since it makes a For Each, you can make the count from the id of your entity.

if id = NullIdentifier(), add +1 to the variable "Created", otherwise +1 in the variable "Updated".


Regards,

Carlos Alfradique

Solution

Hello Diego,

How are you verifying if your register be in your table "Funcionário" ? At this point you can check whether a creation or an update has been made, and assign Created + 1 or Updated + 1. Can be interesting you use a structure with this two atributes.


Have a nice job.

Rodolfo Póvoa Leal


Hi Diego,

Before and After populating the excel record to the entity/table store the max id to the local variable i.e.


Before:

MaxIdOld (Local Variable - Integer data type)

MaxIdOld = SQL1.Integer.value

After:

MaxIdLatest (Local Variable - Integer data type)

MaxIdLatest = SQL2.Integer.value


Variables (Integer data type): NewRegistersCount, UpdatedRegistersCount, ExcelRecordCount

Formula:

NewRegistersCount = MaxIdLatest - MaxIdOld

UpdatedRegistersCount = ExcelRecordCount - NewRegistersCount


Hope it helps :)


Kind Regards,

Benjith Sam

Benjith Sam wrote:

Hi Diego,

Before and After populating the excel record to the entity/table store the max id to the local variable i.e.


Before:

MaxIdOld (Local Variable - Integer data type)

MaxIdOld = SQL1.Integer.value

After:

MaxIdLatest (Local Variable - Integer data type)

MaxIdLatest = SQL2.Integer.value


Variables (Integer data type): NewRegistersCount, UpdatedRegistersCount, ExcelRecordCount

Formula:

NewRegistersCount = MaxIdLatest - MaxIdOld

UpdatedRegistersCount = ExcelRecordCount - NewRegistersCount


Hope it helps :)


Kind Regards,

Benjith Sam

I think it's easier to use the accountants to solve this question, @Diego is already checking in the record of the existence or not of the registry. In this same step he can use the counters ( Created, Updated - Integer Type), without having to make queries the database to know the Max (id).


best regards,

Rodolfo Póvoa


Carlos Alfradique wrote:

Hi there Diego.

Since it makes a For Each, you can make the count from the id of your entity.

if id = NullIdentifier(), add +1 to the variable "Created", otherwise +1 in the variable "Updated".


Regards,

Carlos Alfradique

Thanks to everybody for the help.

This was exactly how I solved my problem, if the id = null then created = created +1, else updated = update+1.


Thank you, Carlos!


Diego Costa wrote:

Carlos Alfradique wrote:

Hi there Diego.

Since it makes a For Each, you can make the count from the id of your entity.

if id = NullIdentifier(), add +1 to the variable "Created", otherwise +1 in the variable "Updated".


Regards,

Carlos Alfradique

Thanks to everybody for the help.

This was exactly how I solved my problem, if the id = null then created = created +1, else updated = update+1.


Thank you, Carlos!


Your Welcome Diego.

Glad to have helped you.

Have a nice day.

Regards,

Carlos Alfradique