Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Macro expressions in CMS Desk > Forms > Notification e-mail/Autoresponder View modes: 
User avatar
Member
Member
Dlglsh - 7/27/2012 8:33:34 AM
   
Macro expressions in CMS Desk > Forms > Notification e-mail/Autoresponder
Hi,

I have a notification and autoresponder email being sent for my CMS Desk > Forms form. In the custom layout I am displaying for form info which is all OK, except the field value for the uploaded file on my form is displaying as a hyperlink, which I don't want.

If I use {%FileUploadFieldname%} I get the GUID.pdf/filename.pdf displayed, not as a hyperlink, so I'm half-way there, but I don't want the GUID.pdf/ part displayed.

According to http://devnet.kentico.com/docs/devguide/available_macro_methods.htm#string_methods there is a split string method, which I can use the '/' as a delimiter - but I can't figure out how to get it working in the custom layout.

Can someone please tell me the correct way to use the String[] Split (String text, String delimiters) method, within the custom layout?

Or, alternatively, is there a way to stop the $$value:FileUploadFieldname$$ displaying as a hyperlink?

Thanks in advance for your help.

Matt

User avatar
Member
Member
Dlglsh - 7/27/2012 8:48:02 AM
   
RE:Macro expressions in CMS Desk > Forms > Notification e-mail/Autoresponder
If I use the substring method, I can get this working: {%FileUploadFieldname|(substring)41%} but this will only work assuming the GUID created by Kentico is always 36 characters and that the file extension is always 3 characters - otherwise it's starting cropping the name of the file.

I thought I'd put this in here in case anyone suggests it as an alternative.

User avatar
Member
Member
nicolas.juteau-nexun - 7/27/2012 8:50:50 AM
   
RE:Macro expressions in CMS Desk > Forms > Notification e-mail/Autoresponder
Hi Matt,

I'm not sure wheter you can display $$value:FileUploadFieldName$$ as hyperlink out of the box. However here is how you can do this using macro methods:

In order to achieve this using Split, you need to be able to access the Length (or Count) property of the returned String[], which doesn't seems to be supported...

However, here is something that will work for sure:

{% Remove("/this/is/a/file.pdf", 0, LastIndexOf("/this/is/a/file.pdf", "/") + 1) %}


Hope it helps.

Regards,
Nicolas

User avatar
Member
Member
Dlglsh - 7/27/2012 9:01:44 AM
   
RE:Macro expressions in CMS Desk > Forms > Notification e-mail/Autoresponder
Brilliant! That's worked a treat.

Thanks, Nicolas.

Matt

User avatar
Member
Member
Dlglsh - 7/30/2012 2:39:35 AM
   
RE:Macro expressions in CMS Desk > Forms > Notification e-mail/Autoresponder
Hi Nicolas,

I've come across a small problem using the above line of code. If a file hasn't been uploaded the email comes through corrupt (as it's trying to resolve LastIndexOf on an empty string or null value). So I need to use an if statement to only use that line of code if the string is not empty, but I can not get the if statement to work.

Have you used something similar before? If so, how did you get around the issue of an empty string/null value.

Thanks,

Matt

User avatar
Member
Member
nicolas.juteau-nexun - 7/30/2012 8:36:10 AM
   
RE:Macro expressions in CMS Desk > Forms > Notification e-mail/Autoresponder
Hi Matt,

Yes I did. I see you already posted your question here.

See the answer there :)

Cheers,
Nicolas