Is it possible to load functions from a database or file at run-time. I'ld like for my users to be able to create their own functions. These functions can later be used by the program. Can this be done?
I don't think you can do it so straight forward like that. I think you will have to do calculator type functionality on the interface and store the calculation 'instructions' in the database.
You could have a 'formula' field of type string in the db and link the record to input fields and output fields.
eg
formula table
id formulastring
1 'a*a' or 'sqr(a)'
input table
id fieldval field type
1 5 'real' this could be an id to a fieldtype table
Output table
id field type
1 'integer'
Also, you can you variants in your calculations.
Read in the formula and parse it. Then calculate using the input values and then format the output using the output value type. In this example you would use TRUNC on the resulting real type.
hope this gives you some food for thought anyway...
lou
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.