Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
It is not part of Creo functionality to create functions in relations.
You can however create mapkeys to automate typing in relations. You can also create UDFs that have relations built in. Lastly there are several toolkits available (jlink, weblink, vb, etc) that allow you to more fully automate Creo. If you are interested in automating Creo there is going to be a webinar this Thursday at 1pm EST talking about just that:
https://ptc.zoom.us/webinar/register/WN_q7sn4TyDQaG328fc8SVDcQ
This isn't possible. Relations are processed in a serial manner every time you regenerate. There is no looping or function definition capability, regrettably. That's why if you need to do something like calculate the closest fraction based on a floating point value, or generate a few strings from real numbers, you end up with a very long list of relations, with many IF - ELSE- ENDIF statements.
If you have a license for the BMX module you can use an Excel analysis feature which would may support what you are trying to do.