Subtract a fixed data from a table

I have the sum of some values of a data table that I need, to that value I need to subtract from the total sum of users “CEDULA” The “CEDULA” is equal to “123456” and it adds the value that corresponds to this user in the column “IBCS” to which this user corresponds and subtracts it from the total value initially stored in the “CEDULA”.

I have stored the value of the sum of the “CEDULA” I need



to this value that is stored I need to subtract the value that corresponds to this user “CEDULA”


But I still can’t get this value down

Help please

@ppr
@supermanPunch

@Beatriz_Eugenia_Duqu Can you tell us what exactly is the problem that you are facing?

Are you not able to find the Row that has the CEDULA value as 123456 ?

I need that in case the “IBCS” corresponding to this cedula if it is repeated is added and then the “CEDULA” equal to 123456 after adding the “IBCS” subtract the value of the “IBCS” corresponding to the total value of the Sum of the “IBCS” equal to “EPS010”, therefore I am trying to set “CEDULA=‘123456’” and the rest to the previous total


I need to subtract the sum value in which is stored the values less than 8778020, I must subtract the value of the “IBCS” of the card “123456”

@Beatriz_Eugenia_Duqu
it is more easy to understand if the expected output explanation comes along with the sample input data.

Scanning your code lines comes to first result:
the sum function used for a datatable requires the use of asEnumerable

yourDataTableVar.AsEnumerable.Sum(Function ( r ) CXConversionMethod(r(ColNameOrIndex).toString…

Unclear about the dtSuraMenor Variable. But if this variable is of datatype datatable. then the rows count is retrieved with dtSuraMenor.Rows.Count

As already mentioned above it is easier if we can refer to the complete information / details instead of only fragments.

Thanks for your support

2 Likes

I already did it

Regards,

Thank you very much for all your help, you helped me to finish what I needed

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.