Hi,

This is more complex than it needs to be.

You might be able to use an ND data object if you just overrode the sql a 
bit to specify 'count'.  Other people could help you better than I.

If you could use an ND data object then you might be able to make this a 
vanilla bound page.

You don't need to use session objects to store stuff in between the 
execution of the sql and display processing.  You can put these into 
instance variables.  Then in onbeforerowdisplay you could use 
event.getRowIndex into the two-dimensional results set, where rowindex 
points to the current row, and column 0 is the department, and column 1 is 
the number of forms.

As an aside, since the temp storage is unnecessary, java makes it very easy 
to deal with multi-dimensional data structures.  There's no reason to 
squeeze a 2 dimensional result set into a one dimensional vector, and then 
output it to the 2-dimensional page structure.

I'm not sure what you're trying to do with the href.  ND4 hrefs are very 
wired and hard to work with in non-standard ways.  If you could start over 
and make your href work according to the standard Studio 'pointy-clicky' 
options for passing data from one page to another, you'd be much better 
off.  My approach, when this is not possible, is to declare the field in 
the studio as static text and then put out the complete html for an href 
that calls an ND3 event, where the signature is:
public int someEvent(String[] args).

In composing the html, if I want to pass the value "accounting", the html 
would contain (with other stuff, like session id name value pair) 
"someEvent(accounting)".  In the body of the method, this value would be 
available as "args[0]".

-- Curt Springer, Team ND


At 03:17 PM 10/13/99 -0400, you wrote:
>Hi
>
>I am populating 2 fields departmentname(href) and a count field in a
>repeated by dynamically executing a SQL stmt. I am unable to pass the value
>stored in the href repeated field(stDepartmentName) to the next page as a
>session variable.
>
>public int this_onBeforeLoadEvent(CSpPageEvent event)
>{
>         double nTotalForms = 0;
>         try{
>                 String query = "Select DEPARTMENTNAME,COUNT(FORMNAME) from
>TRACK_FORM where COMPLETIONSTATUS IN (<values>) group by
>DEPARTMENTNAME";
>                 CSpDBResult results =
>CSpDataObject.executeImmediate("dsProject",query);
>                 int errorCode = results.getResultStatus().getErrorCode();
>                 if ((errorCode == CSpDataObject.SUCCESS) || (errorCode ==
>CSpDataObject.END_OF_FETCH))
>                 {
>                         CSpDBResultTable table = results.getResultTable();
>                         CSpVector vData = new CSpVector();
>                         int nMaxIndex = table.getNumRows() * 2;
>                         for (int i=0;i<table.getNumRows();i++)
>                         {
>                                 for (int j=0;j<2;j++)
>                                 {
>                                         vData.put(table.getRowData(i,j));
>                                         if (j == 1 )
>                                         {
>                                                 nTotalForms +=
>table.getRowData(i,1).doubleValue();
>                                         }
>                                 }
>                         }
>
>                         CSpider.putUserSessionObject("vecData",vData);
>                         CSpider.putUserSessionObject("nMaxIndex",new
>CSpInteger(nMaxIndex));
>                         CSpider.putUserSessionObject("nTotalForms",new
>CSpDouble(nTotalForms));
>                 }
>                 else{
>                         CSpLog.send(this,CSpLog.CRITICAL,"error" +
>errorCode);
>                 }
>         }
>         catch(Exception ex)
>         {
>                 CSpLog.exception(this,"calling method name",ex);
>         }
>
>         return (PROCEED_WITH_BUILTIN_HANDLING);
>         }
>//]]SPIDER_EVENT<this_onBeforeLoadEvent>
>
>
>//[[SPIDER_EVENT<Repeated2_onBeforeRowDisplayEvent>
>public int Repeated2_onBeforeRowDisplayEvent(CSpDataDrivenVisualEvent event)
>{
>         int row = event.getRowIndex();
>         int nMaxIndex =
>CSpider.getUserSessionObject("nMaxIndex").intValue();
>         if (row * 2 >= nMaxIndex)
>         {
>                 return STOP_PROCESSING;
>         }
>
>         CSpVector vData = (CSpVector) CSpider.getSessionObject("vecData");
>         CSpRepeated rp = (CSpRepeated) event.getSource();
>
>         rp.setDisplayFieldValue("*stDepartmentName",vData.get(row*2));
>         rp.setDisplayFieldValue("*stFormCount",vData.get((row*2)+1));
>
>         CSpHref hr = (CSpHref) rp.getDisplayField("*stDepartmentName");
>         String p1[] = new String[1];
>         String p2[] = new String[1];
>         p1[0] =  vData.get(row*2).stringValue();
>         hr.setDisplayFormat( new CSpFormattedString( p1, p2 ));
>
>         return (PROCEED_WITH_BUILTIN_HANDLING);
>}
>//]]SPIDER_EVENT<Repeated2_onBeforeRowDisplayEvent>
>
>Any help would be greatly appreciated
>
>Thanx much
>Vinny

_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to