This topic is locked

Custom Code

2/24/2009 2:19:51 PM
ASPRunnerPro General questions
E
ErinSigma author

I was recommended to come here for assistance, so here goes (I'm still somewhat new to asprunner).
I have a registration system with a User table that has Job Listings Table related 1:M. When a user registers, the Reg_Status is set to "Pending" until an admin/acct manager sets it to Disabled or Active.
I have a piece of custom code that I use in the List Page as follows:



if ucase (rs("Reg_Status"))="PENDING" then

strValue = "<font color=brown>" & strValue & "</font>"

elseif ucase (rs("Reg_Status"))="DISABLED" then

strValue = "<font color=red>" & strValue & "</font>"

else

strValue = "<font color=green>" & strValue & "</font>"

end if


This works well and I have no errors. I was/am a little surprised that it shows up on the VIEW page, but that may be a bonus (I would have thought they were mutually exclusive).
Anyway I digress.
When a user clicks on the VIew link to see his/her Job Listings, I get this error:
Item cannot be found in the collection corresponding to the requested name or ordinal.

/aspr/include/commonfunctions.asp, line 577


Viewing the code at line 577 (or there abouts), it has this code:
if ucase (rs("Reg_Status"))="PENDING" then

strValue = "<font color=brown>" & strValue & "</font>"

elseif ucase (rs("Reg_Status"))="DISABLED" then

strValue = "<font color=red>" & strValue & "</font>"

else

strValue = "<font color=green>" & strValue & "</font>"

end if

So this is the code that I have in Custom View, but I don't understand why I get this error.
I believe it may be because I am displaying the Parent record (Master Table info-List) on the child page when viewing???
How can I fix this. I really would like to be able to display the status in the method above.
Thanks
ps: I hope this is enuff info.

E
ErinSigma author 2/24/2009

Hi all, I just confirmed my suspicions. I removed the "Display Master Table..." option in the Link between the master table and child (Datasource Tables) and regenerated and tried it.
No problems now. However, I need to have the Parent Record displayed when the Child (related) record is displayed.
So my question still remains on how to fix this.
Thanks for the patience and assist.
Erin <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=38193&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

R
Roger 2/24/2009

Hi Erin.
First of all (and most important), I'm new at this product so this worked for me, but it may not be exactly correct. Perhaps others have other ideas.
Instead of using the "RS" collection, try using strValue
I searched and searched and didn't find anything that was relavent (now my search criteria may be off).
Also, I tried your code and had the same issue. If I removed child links in the Datasource Tables Setup screen - it worked fine.
So, I ran my project through my ASP Studio debugger and found that strValue is used to create the output. Tedious, but this was my finding.
I've tried several times to view different Parent Records and it's siblings and no problems so far. I've only tested it on about 10 accounts, but it seems to be ok.
Bearing in mind that my test project is not exactly like yours, so I just simply chose several different columns (fields) and applied different fonts and font colors.
Hope it helps, and if someone has a better way to do this, I would go with the more experienced folks.
Roger.

E
ErinSigma author 2/24/2009

Thank you Roger, I just tried your suggestion and it worked like a charm.
I appreciate that you are new (as am I), so I'm going to watch this thread to see if there are other points of view or perhaps, better ways of doing ths.
I'd rather go with "accepted methods" than not. I don't mean to suggest that this is poor or inadequate, but I just want to make sure that I do this right.
Thanks again.

Sergey Kornilov admin 2/24/2009

This is correct, strValue is both input and output parameter in Custom 'View as" type.

E
ErinSigma author 2/25/2009

Thank you for the confirmation and the help.