ascx transformation relationship conditional statement

Hello DevNet,
In an ascx transformation I have under one of my repeaters, I would like to check for if that repeated item is in a specific relationship, and display something if that's true. Digging through the API, I found CMS.DocumentEngine.RelationshipInfoProvider.GetRelationshipInfo(int,int,int) but was unable to make it work. I was able to get all the required int's, left and right document id's and the relationship id, but I don't think that function can be used inline? Do you know a way that I can return true if a relationship exists? Do I need to create a custom transformation function in the appcode to do something like this? Thank you.

Recent Answers

You could to it by creating a custom macro, which I would recommend if you need to use it in more than on place. Also, its easier to maintain and upgrade, because there is a central location to go to(App_Code). A quick approach other than that, would be to use the script runat="server" tag and to place a method inside of that. Then call the method directly in your transformation. I would strongly suggest creating a custom macro method, but those are two approaches that you could take.

Brenden, I understand your answer, and it worked for me in the case of displaying something when the iterated item is in that relationship, but what I actually need to do is NOT show something when that relationship exists. Or show something (it's a button in html) when the iterated page is NOT in that relationship. I know I could take your solution, create a hidden element with it, and then place some javascript that would strip out the button that I don't want to show in the case of this event based on that hidden element, but I doubt that's the right way to approach this. Do you have a similar solution where the logic only shows a button if the page is NOT in the specified relationship? Thank you