Using a Function to call info based on entered variable

Using a Function to call info based on entered variable

Hi all

So heres my case, any advise is appreciated. 

Im making a calculator for Duty/Tariff rates

USer inputs the HTS code, and i need the system to provide the Duty ad Tariff rate.

I want to make a single function (or maybe two, one for duty and one for tariff) that will hold the list of HTS codes and their duty rates

And then in my active form, when a user provides an HTS code, i want it to call the other function(s) and then provide back the Duty/Tariff rates

Would i use a string function? how do i get it to take a param from my other form and use that as the variable to determine the Duty/Tariff based on the list?

Any thoughts?