This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - How to remove space in the 'keyed name'?

Harsha - Friday, November 23, 2012 3:47 AM:

Hi, For my Item type, I have created two properties and assigned the Keyed Name Orders as 1 & 2 respectively. On my Item type's form I created a field with data source as keyed_name . Now, the field is displaying the values of both properties by seperating them with a space. But I don't want the space to be displayed. How to remove the space between the two values? I want to display the both values without a space seperating them. Please help me! Thank You Harsha

Dave_Rollinson - Monday, November 26, 2012 1:35 PM:

You could use an "onAfterGet" Method to change the keyed_name attribute of the Items (C# below):

// Change the keyed_name to remove spaces...
for (int i = 0; i < this.getItemCount(); i++) {
  Item thisItem = this.getItemByIndex(i);
  thisItem.setAttribute("keyed_name",thisItem.getAttribute("keyed_name","").Replace(" ",""));
}
return this;



kentonv - Friday, December 14, 2012 9:16 AM:

An alternative option for this would be to create the custom keyed name in the database.  Use the ItemType Server event GetKeyedName to set the keyed_name property with whatever values you want.  Something like the below VB code would work most of the time.

Me.setProperty("keyed_name",Me.getProperty(field1) & Me.getProperty(field2))

While the previous suggestion would work well, it is called for every item every time it is retrieved.  The GetKeyedName event is probably called less frequently for items that are being searched/viewed more than updated, and should give better performance.