Total on hand issues

Total on hand issues

I have a subform where I add quantity distributed or quantity returned in inventory.  The total on hand is part of the subform and I have it populated with the queantity on hand. 
The workflow formula is

if(SubForm.Quantity_to_Distribute != null)

{

x = Add_New_PPE[ID == input.SubForm.Select_PPE_Description];

x.Total_On_Hand=input.SubForm.Total_PPE_On_Hand - input.SubForm.Quantity_to_Distribute;

}

else if(SubForm.Quantity_to_Return != null)

{

x = Add_New_PPE[ID == input.SubForm.Select_PPE_Description];

x.Total_On_Hand=input.SubForm.Total_PPE_On_Hand + input.SubForm.Quantity_to_Return;

}

The workflow to populate the subform is
if(Add_New_PPE[ID = input.SubForm.Select_PPE_Description].count() != null)
{
x = Add_New_PPE[ID == input.SubForm.Select_PPE_Description];
input.SubForm.Total_PPE_On_Hand = x.Total_On_Hand;
input.SubForm.PPE_Restock_Level = x.PPE_Restock_Level;
input.SubForm.Unit_dispensed = x.Unit;
}


And it it works for the first item.  When I add a second or sunsequent items in the subform, the total on hand doesn't populate.  Any ideas? 






                            Zoho Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation


                                        Manage your brands on social media



                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources



                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources


                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources


                                                            Zoho Sprints Resources


                                                              Qntrl Resources


                                                                Zoho Creator Resources


                                                                  Zoho WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • Functions

                                                                        Functions

                                                                      • Meetups

                                                                        Meetups

                                                                      • Kbase

                                                                        Kbase

                                                                      • Resources

                                                                        Resources

                                                                      • Digest

                                                                        Digest

                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner




                                                                            Design. Discuss. Deliver.

                                                                            Create visually engaging stories with Zoho Show.

                                                                            Get Started Now