Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Data macro as parameter of a Custom macro not resolving View modes: 
User avatar
Member
Member
iverschuren@marcusthomasllc.com - 8/27/2013 9:03:08 AM
   
Data macro as parameter of a Custom macro not resolving
Hello, Im having issues sending a parameter to my custom macro. I'm trying to send the Skunumber to my custom macro server code, inside a Content_Table transformation ( the one being called on the Ecommerce email templates). The transformation is text/xml.

The problem seems to be having a data macro as a parameter of the custom macro. I just cant get it to resolve the inner data macro.

This is what I have in the transformation:
{#isshamrockitem|{%SKUNumber%}#}

But as a value, on the code, I get

"{%SKUNumber%}"

I've tried Eval and resolve with no luck. I've also seen http://devnet.kentico.com/Forums.aspx?forumid=65&threadid=34958
So I tried:
{%Custom.isshamrockitem(SKUNumber)%}

But then the server code doesnt even gets hit.

Any ideas?

I'm running Kentico 7.0.28.

Thanks!

User avatar
Member
Member
kentico_sandroj - 9/2/2013 4:05:01 PM
   
RE:Data macro as parameter of a Custom macro not resolving
Hello,

{#isshamrockitem|{%SKUNumber%}#} is the correct way to pass the SKUNumber, I have tried it and it resolves correctly. While debugging the value will show as {%SKUNumber%} but it resolves in the invoice. How are you testing the macro? Please make sure to clear the cache before testing.

Also, I ran the test in 7.0.51 so the issue may be in your hotfix version.

User avatar
Member
Member
iverschuren@marcusthomasllc.com - 9/3/2013 8:34:16 AM
   
RE:Data macro as parameter of a Custom macro not resolving
Hello, thanks for the answer

Unfortunately, it seems that I had a concept error. I thought that I was supposed to be able to get the value of the SKUNumber already resolved when the server code was hit. Is there ANY way to do such a thing just using macros? (get the resolved value of the macro on the server code, that is passed as a parameter)

To get pass this issue, I ended up using macro methods instead, and got it to work like this:

MacroMethod isSupplier = new MacroMethod("IsSupplier", IsSupplier)
{
Comment = "Checks the supplier of the product against the provided Supplier ID.",
Type = typeof(bool),
MinimumParameters = 1
};
isSupplier.AddParameter("SKUID", typeof(int), "The item Skunumber.");
MacroMethods.RegisterMethod(isSupplier);



And then on the actual transformation I used

{%IsSupplier(SKUID)%}


(Just in case someone has the same predicament as I did).


Thanks!