Today, at this moment I am facing a problem and I thought it would be good to blog about it while I am trying to solve it.
Background: My requirement is to get the Short Name of a Contact in the following format: Title + First Letter of the Name + Surname. I.e: Mr M Trueba
- Doesn’t seem to be too complicated… I would just need to get the first letter of the name..and there is magic method in SSRS called GetChar()
- However…we are in a sandbox… http://msdn.microsoft.com/en-us/library/hh547428.aspx#BKMK_Allowed Can’t use that :S
- Let’s try and see if I can separate it with FetchXML… hmm is not looking like it is possible.
- It is possible to group by date, and that will give you the day,month or year only, however it is not possible to split the string in a FetchXML.
- Unless… there is another method to retrieve the a specified number of characters rather than one character only… something like LEFT()
- And there you go, that method will not give you any problem with the sanbox in CRM Online and will let you retrieve the first character of a string
- If your requirement is to retrieve a specific value in the middle of the string you could just use Left() and Substring()
This one was an easy one, but I think it was a great exercise for my head to put my thoughts here while I was solving it 😉
You guys helped a lot! Hehehe