Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Import toolkit 5.5 macro expressions in source field View modes: 
User avatar
Member
Member
lancetek - 5/11/2011 2:22:56 PM
   
Import toolkit 5.5 macro expressions in source field
Hi,
What macro expression would I have to use to substring a source field? I've been trying things like:

={%article_name.substring(0,100)%}" will evaluate the macro expression using the source data and put there the resulting value


Thanks,
Lance

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 5/12/2011 1:30:01 AM
   
RE:Import toolkit 5.5 macro expressions in source field
Hi,

here is an example:

Macro {%username%} returns for example administrator.
Macro {%username|(substring)2;3%} returns min.

Above macros will be resolved in transformations, properties of webpart, etc. For more details please take a look at macro expressions.

If you need to use macro inside code you can use:

string macroResult = CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%macro%}").ToString() %>";


Best regards,
Ivana Tomanickova

User avatar
Member
Member
lancetek - 5/14/2011 2:59:57 PM
   
RE:Import toolkit 5.5 macro expressions in source field
Ivana,
Thanks for the quick response, but using that macro gives me the literal value in the document fields - eg my document name says '{%headline|(substring)0;99%}', instead of the truncated value.

FYI - I'm trying to use it in the 'Source field or expression' column in Step 6 of the tool.

Thanks,
Lance


kentico_ivanat wrote: Hi,

here is an example:

Macro {%username%} returns for example administrator.
Macro {%username|(substring)2;3%} returns min.

Above macros will be resolved in transformations, properties of webpart, etc. For more details please take a look at macro expressions.

If you need to use macro inside code you can use:

string macroResult = CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%macro%}").ToString() %>";


Best regards,
Ivana Tomanickova