cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Function Help

Former Member
0 Kudos

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!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Post Author: edy80y

CA Forum: Formula

Hi,

Thanks for the reply. Unfortunately it does make things easy for me. If i add the custom function in the subreport then i will have to updae that as well whenever a new team is created. I'm looking for a solution where i only have to update the custom function in the main report only and not in the 7 or 8 subreports within it.

Unless i am doing something wrong. I basically copied the contecnt of the Custom Function in the main report and then went into the sub report and created a new Custom Function and pasted the code in it.

Regards,

Eddie S

Former Member
0 Kudos

Post Author: V361

CA Forum: Formula

I have CRXI, Copy your custom function from the main report and try adding the custom functions to the subreport . I think that will resolve the issue. You can edit subreport, create a formula ( if none exist), edit the formula, from there click on report custom functions, I think you will find it is blank. Copy your custom function in and test.