Engincan Yıldız
Engincan Yıldız

Reputation: 25

How can I retrieve data page results in Javascript?

I'm implementing a custom html rule using Here Maps Javascript API. I have coordinates stored in a data type. (about 30000 rows) I need to get each of those rows and draw a polyline in html. How can I get the data page results in html rule ?

Since I use custom service and need to show custom section, I need to implement it on a non-auto generated html rule and use Javascript. Actually I achieve my goal when I set the values in Javascript variabşe statically. (There is no problem for Pega to display custom Maps section generated using Javascript API) However I have to get the coordinates from a data page dynamically. Because it will be dynamic on production.

Upvotes: 0

Views: 2435

Answers (1)

AJ.
AJ.

Reputation: 4534

Check <pega:forEach name="YourPageListPage.PageList"> tag.

I used it once for creating a table in HTML for a Pagelist type property.

Below example may lead you to a direction.

Example:

<table border="1">    
<pega:forEach name="YourPageListPage.PageList"> // YourPageListPage.PageList is Page in which you have 3000 rows

    <tr>    
       <TD>
         <pega:reference name="$THIS.COLUMN1"/> // --> COLUMN1 is the property name inside pagelist
      </TD>
      <TD>
         <pega:reference name="$THIS.COLUMN2"/> // -->  COLUMN2 is the property name inside pagelist
      </TD>
          </tr>
        </pega:forEach>
    </table>

Another method to read any Clipboard page in JavaScript..

<%
ClipboardPage dataPage= tools.findPage("D_DatapageName");// if tools keyword is unrecognized then add PublicAPI tools = ThreadContainer.get().getPublicAPI(); above this line.
//D_DatapageName --> your data page name. You can give any Clipbord page here
ClipboardProperty pageListProperty=  dataPage.getProperty("PageListProperty"); 
// PageListProperty will be list property in your DataPage..for example pxResults in case if DataPage is of class Code-Pega-List

//now if you want to iterate on this pageListProperty then use below method
Iterator iterator = pageListProperty.iterator();
// For eg. iterate over pxResults 
while(iterator.hasNext()){
    ClipboardProperty pageProperty= (ClipboardProperty)iterator.next();
 // PageProperty can be of type Page or just a single property
 // But we need only the pages, so add below condition
    if(pageProperty.getMode()==ImmutablePropertyInfo.MODE_PAGE){
         Iterator iterator2 = pageProperty.iterator();
     // Iterate on all properties of single page (pxResults(1))
         while(iterator2.hasNext()){
             ClipboardProperty property= (ClipboardProperty)iterator2.next();
             String propertyLabel = property.getName(); // this will return the name of the property. For example pyNote

             String propertyValue = property.getStringValue(); // this will return the value inside property. 
          }    


     }

}

%>

Upvotes: 0

Related Questions