Consulta

hola, tengo este assign, el cual trae informacion.
a la hora de ejecutarlo, me trae 13, siendo que esta vacio y tiene que traer 0.
el tema es que aveces lo ejecuto y trae 13 y otras 0, cual podria ser la causa ?

totalSinNCFV = CStr(dtIndustrial.AsEnumerable().Where(Function(row) row(“Status”).ToString() = “Vencida”).Count())

agradeceria su ayuda!

Hi @mively

Check if dtIndustrial data changes between runs. Ensure no concurrent modifications. Trim “Status” values to remove hidden characters. Verify dtIndustrial is populated before counting. Add logs to inspect row count and “Status” values. Debug step by step.

Happy Automation

1 Like

Check if the variable have any default value assigned or not. Also initialise this variable with 0 before executing and see if it is coming as expected when the data table contains expired values and without expired values
@mively

1 Like

@mively,

Reset the variable value to “0” before execution of the assign activity.

totalSinNCFV="0"

And check Status column Contains Expired by this expression

totalSinNCFV = CStr(dtIndustrial.AsEnumerable().Where(Function(row) row("Status").ToString().Contains("Expired").Count())
1 Like

Hi @mively

Your query looks quite confusing could you be more specific by giving an example, that will help to understand better.

@mively

run the bot in debug mode…have a breakpoint on assign and then check the locals panel to see what values are present and use immediate panel to execute the query and check the values from there…this would help you determine the issue if there is any in the data or formula

cheers

1 Like

image
lo inicialice de esa forma

Hi @mively

Sure! Here’s the updated version:

Deberías inicializar totalSinNCFV como un Integer si deseas trabajar con valores numéricos, ya que facilitará realizar operaciones matemáticas y comparaciones.

totalSinNCFV = dtIndustrial.AsEnumerable().Where(Function(row) row("Status").ToString().Trim().ToLower() = "vencida").Count()

Marca como solución si es útil.

1 Like

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