Thanks for your prompt help the web application is fixed.
simple example
RecordSet = Context.SqlMethod(Param1 = request.ID)
if RecordSet: return context.REQUEST.RESPONSE.redirect("%s?message=%s % (context.REQUEST.URL1,"Sorry Record Locked By ' " + RecordSet[0].FieldName
----- Original Message ----- From: "Jonathan Miles" <jonathan.miles@btconnect.com> To: "Dieter Maurer" <dieter@handshake.de> Sent: Thursday, January 16, 2003 11:05 PM Subject: Re: [Zope] Python Script +
" ' ! "))
...
You are quite correct the key point is the [0] when that is missing you get an attribute not found error.
Also the other points on the if statement is quite true.
The main issue was to learn who to get at the fields in the record set. The previous code was one of several were this messaging is used.
Thank again all.
----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Jonathan Miles" <info@jonathan-miles.com> Cc: <zope@zope.org> Sent: Thursday, January 16, 2003 8:46 PM Subject: Re: [Zope] Python Script
Jonathan Miles wrote at 2003-1-16 00:21 -0000:
Can someone help me with this.
I just want to run the salescheck sql method and use a field 'OFFICENAME' in the result set in the message.
It is a simple task and it's been bugging me far to long.
Thank for your help.
orderrecordok = context.salescheck(locationid = request.LOCID, RECID = request.ID)
if not orderrecordok:
return context.REQUEST.RESPONSE.redirect("%s?message=%s" % (context.REQUEST.URL1,' Sorry the Order ' + salescheck.OFFICENAME + ' is not yours')) Apparently, when you run "salescheck", it returns an empty result set. Of course, you cannot access a field in an empty result set.
If you have a non-empty result set "R", then "R[i]" is the i-th result row (0-based) and "R[i].OFFICENAME" would give you the "OFFICENAME" field of this row.
Dieter
participants (1)
-
Jonathan Miles