Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
luis_24
Contributor II
Contributor II

función aggr / function aggr

Hola, tengo un problema al aplicar la funcion aggr,

desde una tabla tengo pedidos y posiciones de pedido para un material tabla1, en otra tabla tengo el material y cantidad de piezas por paquete tabla2 ,

tabla1

Pedido pos pedido cant pedido material
1 1 12 v01
1 2 4 v01
1 3 3 v05
2 1 5 v04
2 2 23 v01

 

tabla2

material piezas
v01 45
v01 45
v01 30
v04 60
v04 60
v05 60

 

ocupo la funcion aggr para contar los paquetes de material es decir la cantidad de veces que tengo el material en mi tabla2, pero produce diferencias y agregar una columna de cantidad de paquetes disponibles debería resultar como la tabla3,

alguien sabe como lo puedo solucionar o otra alternativa para realizar lo mismo?

los resultados no son los correctos, las tablas estan unidas por el campo material

tabla3

Pedido pos pedido cant pedido material paquetes disponibles
1 1 12 v01 3
1 2 4 v01 3
1 3 3 v05 1
2 1 5 v04 2
2 2 23 v01 3

 

Hello, I have a problem when applying the aggr function,

from a table I have orders and order items for a material, and in another table I have the material,

Table 1
Pedido pos pedido cant pedido material
1 1 12 v01
1 2 4 v01
1 3 3 v05
2 1 5 v04
2 2 23 v01
table 2
material piezas
v01 45
v01 45
v01 30
v04 60
v04 60
v05

60

I use the aggr function to count the material packages, that is, the number of times I have the material in my table2, but it produces differences and adding a column with the number of available packages should result in table3,

Does anyone know how I can solve it or another alternative to do the same?

the results are not correct, the tables are joined by the material field

table3
Pedido pos pedido cant pedido material paquetes disponibles
1 1 12 v01 3
1 2 4 v01 3
1 3 3 v05 1
2 1 5 v04 2
2 2 23 v01 3
 
 

 

1 Solution

Accepted Solutions
rubenmarin

Hi, if the relation between table 1 and 2 is using 'material' field I think you only need "Count(piezas)" as expresion

View solution in original post

1 Reply
rubenmarin

Hi, if the relation between table 1 and 2 is using 'material' field I think you only need "Count(piezas)" as expresion