Preciso obter a soma de valores de uma coluna no excel, porem o total somado desses valores não pode passar de 400, poderiam me ajudar com alguma expressão linq ou se puderem apontar o erro desta?
Hi @devrpa746 ,
Could you let us know How are you reading the data ? The datatable dt
does not contain any data as seen from your expression. Are you reading the Excel Sheet using an Read Range
activity before performing this ?
Also do note that the Code Snippet that you are adding is not needed for the UiPath’s Assign
activity’s usage, it is made simple by just using the core part of the function or method that you would want to perform.
For Example: If your Goal is to Calculate sum of the values in a Column in an Excel Sheet, then the Steps would be the below :
-
Read the Excel Sheet using a
Read Range
activity. It will output a Datatable type variable, you can name it asdt
. -
Next using an
Assign
activity we can use the below Expression to calculate the Sum of the column values.
columnSum = dt.AsEnumerable().Sum(Function(row)CDbl(row("Vl. Pedido").ToString))
- Now the comparison for the 400 value can be done in the below way using an
Assign
activity and the value can be assigned.
totalSum = if(columnSum>400,400,columnSum)
Do let us know if you are still facing difficulties in performing this.
O que me retornou foi apenas o número 400. Não mencionei anteriormente, mas preciso obter essas linhas que foram filtradas pelo limite de 400
segue o processo feito
Eu preciso obter os itens da coluna A, baseada na regra da soma total que não ultrapasse 400.
Obrigada, fico no aguardo.