0

First of all, apologies if the question is not clear, I didn't know how to phrase it. Basically, I am working on this recipe : http://developer.force.com/cookbook/recipe/creating-a-sitemap-for-a-salesforce-knowledge-public-knowledge-base

The problem is that one of the fields I want to add, I need to do some string manipulation on a field before its rendered, I don't want to do this on the page side as it will be too complicated.

So my question is, by looking at the getFAQList method and assuming the field I want to pass to a new get method is the field localized_title__c, how can I modify the value of that field for the current item on the list and keep binding inside the apex:repeat?

I hope that makes sense.

Thanks

2
  • I am not sure if I understand it right, so you want to manipulate localized_title__c field and show the modified value in <apex:repeat>? Mar 21, 2013 at 12:45
  • That's correct.
    – PepeFloyd
    Mar 21, 2013 at 12:49

1 Answer 1

2

Try the following - I added a for loop after the Database.query(). manipulateString() is the method where you would want to do the String manipulation. And when you bind the value in the apex:repeat it would show you the modified one.

      // A slightly more complex query based on the product and lang URL params, to return the most recent 1000 articles
  public Documentation__kav[] getDocumentationList(){
    String productcode = ApexPages.currentPage().getParameters().get('product') + '__c';
    String langcode = ApexPages.currentpage().getParameters().get('lang') + '__c';
    String qry = 'select id, knowledgearticleid, lastpublisheddate, localized_title__c, title from Documentation__kav where (PublishStatus = \'Online\' AND IsVisibleInPkb = true) WITH DATA CATEGORY Products__c AT ' + productcode + ' AND Languages__c AT ' + langcode +' ORDER BY LastPublishedDate DESC LIMIT 1000';
    Documentation__kav[] d = database.query(qry);   
    for( Documentation__kav doc : d){
       doc.localized_title__c = manipulateString(doc.localized_title__c);
    }
    return d;   
  }
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .