Seshu,
I think you can simplify your code by putting everything in the
submit_onWebEvent instead of using
this_onBeforeExecuteEvent(CSpDataObjectEvent event) too.
All you have to do in submit_onWebEvent is
1. get the userSessionObjects uid and pword value.
2. Get a handle to the dataobject
CSpSelect doVer = (CSpSelect)CSpider.getDataObject("doVerify");
3. clear the dynamic criteria
4. add your dynamic area
5. execute the dataobject
6. proceed with the rest
Hope this helps.
-Nimmi
-----Original Message-----
From: Seshu [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 28, 2000 8:54 AM
To: Aby Mathew
Cc: [EMAIL PROTECTED]
Subject: Re: [ND] data object with dynamic criteria
Hi All,
Now I undestand the problem but do not know how to fix it. I try to explain
it
more clearly now. In the first page( pagLogin), I have this code in the web
event of the button.
//[[SPIDER_EVENT<submit_onWebEvent>
public int submit_onWebEvent(CSpWebEvent event)
{
CSpider.putUserSessionObject( "sesuserid",
getDisplayFieldValue("userid"));
CSpider.putUserSessionObject( "sespassword",
getDisplayFieldValue("password"));
CSpSelect doVer = (CSpSelect)CSpider.getDataObject("doVerify");
doVer.execute();
return(PROCEED);
//]]SPIDER_EVENT<submit_onWebEvent>
Two user sessios objects are set and then the call to data object is made
for
it's execution. Then, I have this code in the onBeforeExecute event of data
object. As can be seen, I am retrieving those user session objects which
become
part of the dynamic criteria. During the first time execution of data
object,
these user session objects are some how not available. In the second click
of
the button ( after using browser back button), the user session objects are
becoming available and the dynamic criteria is set correctly and code
executes.
I have used user session objects because they are needed in a few pages down
the
login page. I think there may be a better way for doing the login validation
instead of using the user session objects.
//[[SPIDER_EVENT<this_onBeforeExecuteEvent>
public int this_onBeforeExecuteEvent(CSpDataObjectEvent event)
{
CSpString uid = (CSpString)CSpider.getUserSessionObject("sesuserid");
CSpString pword = (CSpString)CSpider.getUserSessionObject("sespassword");
String mySQL = new String("dbo.user_prof.id_user = '"+uid+"'"
+" AND dbo.user_prof.Password ='"+pword+"'");
CSpSelect doVer = (CSpSelect)CSpider.getDataObject("doVerify");
doVer.clearDynamicCriteria();
doVer.addDynamicStrCriterion(mySQL);
return (PROCEED);
}
//]]SPIDER_EVENT<this_onBeforeExecuteEvent>
Hope I have clarified. Can any one please provide the solution?
Seshu
Aby Mathew wrote:
> This is a long and somewhat confusing thread. I haven't followed it
> entirely. The scope of my reply is confined to:
>
> > Using back button of browser and clicking the button again
> > has generated the SQL
> > correctly and worked fine.
>
> This doesn't surprise me. It tells me something is wrong with the code or
> Linking of the Pages thru the Studio or most likely, a combination of
both.
> Something to watch out for when you combine custom code with Studio
> (pointy-clicky according to Curt) stuff.
>
> My guess is that the SQL is executed first time without the dynamic
> criteria and later some addDynamicCriteria(), implicit or explicit is
done.
> It can be a explicit code in the second page or implicit link between the
> pages created thru the Studio.
>
> DynamicCriteria are sticky. Once added, they stay for the UserSession
unless
> cleared.
>
> Aby
> TeamND
>
> > -----Original Message-----
> > From: Seshu [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 27, 2000 2:39 PM
> > To: Shamdasani Nimmi-ANS004;
> > [EMAIL PROTECTED]
> > Subject: Re: [ND] data object with dynamic criteria
> >
> >
> > Hi all,
> >
> > Before I implement what Nimmi has suggested, I explain below
> > exact behaviour
> > once again.
> >
> > The first click of has generated this SQL, with no result.
> > execute SQL command: |SELECT ALL dbo.grp_prof.cd_appl_type_authtn FROM
> > dbo.user_prof, dbo.grp_prof WHERE (dbo.user_prof.name_grp =
> > dbo.grp_prof.name_grp)|
> >
> > Using back button of browser and clicking the button again
> > has generated the SQL
> > correctly and worked fine.
> >
> > execute SQL command: |SELECT ALL dbo.grp_prof.cd_appl_type_authtn FROM
> > dbo.user_prof, dbo.grp_prof WHERE (((dbo.user_prof.name_grp =
> > dbo.grp_prof.name_grp)) AND dbo.user_prof.id_user = 'widmxpHVE' AND
> > dbo.user_prof.Password ='hve')|
> >
> >
> > However, I notice another SQL being generated. I do not
> > understand how this is
> > generated?
> >
> > SQL command: |SELECT ALL dbo.user_prof.id_user,
> > dbo.user_prof.name_user,
> > dbo.user_prof.name_grp, dbo.user_prof.name_job_title,
> > dbo.user_prof.nbr_ph,
> > dbo.user_prof.name_proj, dbo.user_prof.addr_email,
> > dbo.user_prof.addr_strt,
> > dbo.user_prof.cd_inpt_type, dbo.user_prof.flag_rslt_onli,
> > dbo.user_prof.flag_rslt_ftp, dbo.user_prof.id_ftp_lgn,
> > dbo.user_prof.text_ftp_pswrd, dbo.user_prof.text_ftp_ip_addr,
> > dbo.user_prof.text_trgt_drctry, dbo.user_prof.Password FROM
> > dbo.user_prof WHERE
> > (dbo.user_prof.id_user = 'widmxpHVE')|
> >
> >
> > Shamdasani Nimmi-ANS004 wrote:
> >
> > > Yes you do have to put in the join criteria again for the tables
> > >
> > > -Nimmi
> > >
> > > -----Original Message-----
> > > From: Seshu [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, January 27, 2000 4:07 PM
> > > To: Shamdasani Nimmi-ANS004
> > > Subject: Re: [ND] data object with dynamic criteria
> > >
> > > Hi Nimmi,
> > >
> > > Thanks for your reply. I have another question that I am
> > pasting below
> > > which
> > > I asked Janet in reply back to her. Could you also look
> > into and suggest
> > > some
> > > thing?
> > >
> > > Hi Janet,
> > >
> > > Thanks. It worked. But I have one more problem. The
> > concerned dataobject is
> > > using two tables. And
> > > there is one join condition used in the data object
> > properties in studio.
> > > The
> > > first click of the
> > > button generates the following SQL.
> > >
> > > execute SQL command: |SELECT ALL
> > dbo.grp_prof.cd_appl_type_authtn FROM
> > > dbo.user_prof, dbo.grp_prof
> > > WHERE (((dbo.user_prof.name_grp = dbo.grp_prof.name_grp)) AND
> > > dbo.user_prof.id_user = 'widmxpHVE'
> > > AND dbo.user_prof.Password ='hve')|
> > >
> > > And all the subsequent clicks of the button generate this
> > SQL and this works
> > > file.
> > >
> > > SELECT ALL dbo.user_prof.id_user, dbo.user_prof.name_user,
> > > dbo.user_prof.name_grp,
> > > dbo.user_prof.name_job_title, dbo.user_prof.nbr_ph,
> > dbo.user_prof.name_proj,
> > > dbo.user_prof.addr_email,
> > > dbo.user_prof.addr_strt, dbo.user_prof.cd_inpt_type,
> > > dbo.user_prof.flag_rslt_onli,
> > > dbo.user_prof.flag_rslt_ftp, dbo.user_prof.id_ftp_lgn,
> > > dbo.user_prof.text_ftp_pswrd,
> > > dbo.user_prof.text_ftp_ip_addr, dbo.user_prof.text_trgt_drctry,
> > > dbo.user_prof.Password FROM
> > > dbo.user_prof WHERE (dbo.user_prof.id_user = 'widmxpHVE')|
> > >
> > > However, I notice that the SQL generated second time is
> > including all the
> > > data
> > > fields and the join
> > > criteria is missing in this, which was present in the first SQL.
> > >
> > > Do we have to include the join condition also in the
> > dynamic criteria?
> > >
> > > Seshu
> > >
> > > Shamdasani Nimmi-ANS004 wrote:
> > >
> > > > Seshu,
> > > >
> > > > If the uid or pword are character fields your need to put
> > single quotes(')
> > > > around them in your SQL.
> > > >
> > > > -Nimmi
> > > >
> > > > -----Original Message-----
> > > > From: Seshu [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, January 27, 2000 3:24 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [ND] data object with dynamic criteria
> > > >
> > > > Hi All,
> > > > I am getting errors with the execution of data object. I
> > am adding a
> > > > dynamic criteria to the dataobject in the onBeforeExecuteEvent of
> > > > datobject. I have turned the all three options turned on
> > in command
> > > > center for the dubug. the error log is enclosed in the
> > attatchment.
> > > > Following is piece of code.
> > > >
> > > > //[[SPIDER_EVENT<this_onBeforeExecuteEvent>
> > > > public int this_onBeforeExecuteEvent(CSpDataObjectEvent event)
> > > > {
> > > > CSpString uid =
> > (CSpString)CSpider.getUserSessionObject("sesuserid");
> > > > CSpString pword =
> > > > (CSpString)CSpider.getUserSessionObject("sespassword");
> > > > String mySQL = new String("dbo.user_prof.id_user = "+uid+
> > > > " AND dbo.user_prof.Password ="+pword);
> > > > CSpSelect doVer = (CSpSelect)CSpider.getDataObject("doVerify");
> > > > doVer.clearDynamicCriteria();
> > > > doVer.addDynamicStrCriterion(mySQL);
> > > > return (PROCEED);
> > > > }
> > > > //]]SPIDER_EVENT<this_onBeforeExecuteEvent>
> > > >
> > > > Can anyone help?
> > > > Thanks in advance.
> > > > We are using sybase database with odbc driver , ND
> > 4.1.3.8 on NT and IIS
> > > > server.
> > > >
> > > > Seshu
> >
> > ______________________________________________________________
> > ___________
> >
> > 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]
> >
> _________________________________________________________________________
>
> 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]
_________________________________________________________________________
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]
_________________________________________________________________________
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]