Hi All, I was wondering if anyone could tell me why this python script (passed no parameters) creates session values for N_prod, N_shed, N_screen, N_pond, N_land, N_soil that are all the same (and TS_*, K_*, P_* values that are similarly the same within their set). What am I doing wrong? Is this a vaguery of the script system, and should I use an external method instead? #This function uses the session data, and a range of coded #values to determine the quantities of TS, N, P, and K #remaining at each step of the process up to land application. #On Entry: requires the Session data values gest, lact, suckers, #weaners, growers, finish, gilt, and boars. #On Exit: returns the modified session data, with additional values #representing the manure produced, Efluent exiting the shed, Effluent #after the screens (if there are any), pond sludge component, pond liquid, #quantities reaching the soil during irrigation, quantity remaining in the soil #following losses: each of these for each of TS, N, P, and K. import math session=context.REQUEST.SESSION #Define loss values: ts_shed=0; ts_screen=20 N_shed=10;N_screen=8;N_sludge=24;N_pond=40;N_irrigation=25;N_soil=25 P_shed=0;P_screen=11;P_sludge=90;P_pond=0;P_irrigation=0;P_soil=0 K_shed=0;K_screen=0;K_sludge=10;K_pond=0;K_irrigation=0;K_soil=0 #Calculate Components at each step, and assign to the session. #_Manure Production session['TS_prod']=session['num_spu']*109.95 #session['N_prod']=round(session['num_spu']*0.081814, 1) session['N_prod']=session['num_spu']*0.081814 #session['P_prod']=round(session['num_spu']*0.33338, 1) session['P_prod']=session['num_spu']*0.33338 #session['K_prod']=round(session['num_spu']*0.8335, 1) session['K_prod']=session['num_spu']*0.8335 #_exiting the shed session['TS_shed']=round(session['TS_prod']*(1-(ts_shed/100)),1) session['N_shed']=round(session['N_prod']*(1-(N_shed/100)),1) session['P_shed']=round(session['P_prod']*(1-(P_shed/100)), 1) session['K_shed']=round(session['K_prod']*(1-(K_shed/100)), 1) #_exiting the screens session['TS_screen']=round(session['TS_shed']*(1-(ts_screen/100)), 1) session['N_screen']=round(session['N_shed']*(1-(N_screen/100)), 1) session['P_screen']=round(session['P_shed']*(1-(P_screen/100)), 1) session['K_screen']=round(session['K_shed']*(1-(K_screen/100)), 1) #_retained in sludge session['N_sludge']=round(session['N_screen']*(N_sludge/100), 1) session['P_sludge']=round(session['P_screen']*(P_sludge/100), 1) session['K_sludge']=round(session['K_screen']*(K_sludge/100), 1) #_retained in the ponds session['N_pond']=round((session['N_screen']-session['N_sludge'])*(1-(N_ pond/ 100)), 1) session['P_pond']=round((session['N_screen']-session['N_sludge'])*(1-(P_ pond/ 100)), 1) session['K_pond']=round((session['N_screen']-session['N_sludge'])*(1-(K_ pond/ 100)), 1) #_reaching the soil session['N_lands']=round(session['N_pond']*(1-(N_irrigation/100)), 1) session['P_lands']=round(session['P_pond']*(1-(P_irrigation/100)), 1) session['K_lands']=round(session['K_pond']*(1-(K_irrigation/100)), 1) #_retained in the soil #session['N_soil']=round(session['N_lands']*(1-(N_soil/100)), 1) session['N_soil']=session['N_lands']*(1-(N_soil/100)) #session['P_soil']=round(session['P_lands']*(1-(P_soil/100)), 1) session['P_soil']=session['P_lands']*(1-(P_soil/100)) #session['K_soil']=round(session['K_lands']*(1-(K_soil/100)), 1) session['K_soil']=session['K_lands']*(1-(K_soil/100)) return ------------------------------------------------------- THanks, Matt Redding ********************************DISCLAIMER**************************** The information contained in the above e-mail message or messages (which includes any attachments) is confidential and may be legally privileged. It is intended only for the use of the person or entity to which it is addressed. If you are not the addressee any form of disclosure, copying, modification, distribution or any action taken or omitted in reliance on the information is unauthorised. Opinions contained in the message(s) do not necessarily reflect the opinions of the Queensland Government and its authorities. If you received this communication in error, please notify the sender immediately and delete it from your computer system network.