isamudysan

Count Calculation for Palletizing

Discussion created by isamudysan on Aug 17, 2016
Latest reply on Aug 18, 2016 by Ben_B94

First, my apologies for forgetting the person who had helped me with this calculation in the past.

 

I have used the below calculation for palletizing in the c_Pallet field:

 

Let ( [

    _count = ExecuteSQL ( "SELECT COUNT(*) FROM MainTable" ; "" ; "" ) ;

    _m = Div ( _count ; 180 ) + 1

] ; "P" & _m

)


What I need today would be a couple of things, if possible:

  1. I need to adapt this calculation for 2 product types, i.e., phones and laptops in the same table.  Phones with a pallet size of 180, and laptops a pallet size of 18.  I know by changing the divisor number will affect the of pallet count number.
  2. I would like to be able to reset the count on a monthly basis, or when a new record is created.

 

The product type values are stored in the ProductType field which is a calculated field looked up by its respective part number.

 

What I've tried thus far:

 

Let ( [

    phone = ExecuteSQL ( "SELECT COUNT(*) FROM MainTable" ; "" ; "" ) ;

    _m = Div ( _count ; 180 ) + 1 ;

    lap = ExecuteSQL ( "SELECT COUNT(*) FROM MainTable" ; "" ; "" ) ;

    _l = Div ( _count ; 18 ) + 1 ;

] ;

  Case (

    ProductType = "Phone" ; "P" & _m ;

    ProductType = "Laptop" ; "P" & _l ; ""

  )

)

 

Unfortunately, didn't work as intended, LOL.  But, I do know that I am missing something.

 

Thanks for all your help everyone!

 

Toufue

Outcomes