Post Author: edy80y
CA Forum: Formula
I have a report with many subreports which all contain the same formula to group teams.When a new team is added i need to update all instances of the formula so they are all up to date.I know of Custom Function so i created one out of the formula in the main report. The problem im finding is that im unable to use that custom function in the sub reports.Am i wring in thinking that a custom function created in a main report can be used in its sub reports??Am i creating the custom function incorrectly? Heres what i have done:
Our database has team names that have a prefix of the State they are in such as: Perth - Team Orange Perth - Team Apple Sydney - Team Grape Sydney - Team Pineapple
At one stage the Teams in Perth had been split into Perth1 and Perth2 resulting in the following records in the database:
Perth1 - Team Orange Perth - Team Orange
Because of this i have created a formula that groups teams into sites:
select Trimleft(mid({team.name},instr({team.name},'-')+1))case 'Team Orange', 'Team Apple': 'Perth'case 'Team Grape', 'Team Pineapple': 'Sydney'default:''
I use this formula in all reports and subreports and i link by them as well, so if a new team is created (for example Perth - Team Pear) i need toupdate all instances of the formula by adding 'Team Pear' to the Perth case.
To fix the problem i created a custom function (called 'site') out of the formula above and it created this:
Funtion (stringvar v1)select Trimleft(mid(v1,instr(v1,'-')+1))case 'Team Orange', 'Team Apple': 'Perth'case 'Team Grape', 'Team Pineapple': 'Sydney'default:''
Now within that main report i am able to go to the formula editor and when i type site() then wording becomes blue but when i go into a sub report to do the same it doesnt react.
I hope i have explained my self well enough for you to understand my predicament without boring you.
Thanks in advance for your help!