This topic is locked

dict expression

12/7/2006 1:47:22 PM
ASPRunnerPro General questions
S
SteveL author

Hi there again

I have this problem I am trying to send a email with certain field information. Before in 4.0 I called the fields using rs("") but apparently I need to use dict("") in 4.1. this seems to work okay on some fields but for some reason when I use dict("") in the edit pages on some fields it works fine while in other fields it clears it out. For example I am trying to send this email with the following code:
Function BeforeEdit(dict, where)
csemail=dict("Email")
dim keys
if dict("Received")="Yes" and dict("EmailSent") = "No" then

message =""
keys = dict.keys

For n = 0 To dict.Count-1

message = message & keys(n) & " : " & dict(keys(n)) & vbcrlf

Next
email=csemail

subject="Networkcar RA#:" &dict("NetworkcarRA#") & "Serial#:" & dict("CarReaderSerial#")& " received"
When I use this the NetworkcarRA# always dissapears after clicking save. I have had this problem with other fields before but wasnt sure what was the cause. Why do some fields work and some fields it doesnt.

Any ideas?

Thanks
_Steve

Sergey Kornilov admin 12/7/2006

This code looks incomplete. Post the whole event code here.

S
SteveL author 12/7/2006

actually i kinda of discovered that this happend when the field is a read only field?
Function BeforeEdit(dict, where)
csemail=dict("Email")
dim keys
if dict("Received")="Yes" and dict("EmailSent") = "No" then

message =""
keys = dict.keys

For n = 0 To dict.Count-1

message = message & keys(n) & " : " & dict(keys(n)) & vbcrlf

Next
email=csemail

subject="Networkcar RA#:" &dict("NetworkcarRA#") & "Serial#:" & dict("CarReaderSerial#")& " received"
sendmail email, subject, message

dict("EmailSent")="Yes"
end if
if dict("Shipped")="Yes" and dict("EmailSent2") = "No" then

message =""
keys = dict.keys

For n = 0 To dict.Count-1

message = message & keys(n) & " : " & dict(keys(n)) & vbcrlf

Next
email=csemail

subject="New data record TEST TEST"
sendmail email, subject, message

dict("EmailSent2")="Yes"
end if
BeforeEdit = True
End Function
here is the whole event code

Sergey Kornilov admin 12/7/2006

So you saying the value of readonly field disappears if you use the above event code?
You can publish your files to Demo Account and send me a link.

S
SteveL author 12/7/2006

So you saying the value of readonly field disappears if you use the above event code?

You can publish your files to Demo Account and send me a link.



yup it dissapears for some reason. I changed some of my other fields "EmailSent" and "EmailSent2" to text since they were doing the same thing and since I changed it they work now..

odd i will try to publish to a demo account now
-steve
i just uploaded to a demo account

http://demo.asprunner.net/steve%5Fnetworkc...A5%5F3/menu.asp
so if you add a record in the customerserivce table then u go to RAunitsReturned and add a record it creates a related daughter record. This is tied by the RA number. So now you go in and try to edit that Records in teh RaUnitsReturend table and for some reason the NetworkcarRA# field dissapears when you edit when you use dict("") in the evvnets code. This was doing it for the Email, EmailSent and EmailSEnt2 fields too till I changed them to be Text instead of ReadOnly

S
SteveL author 12/7/2006

yup i just confirmed it looks like everytime i want to use dict("") to call a field to print out in the emial it erases the field in the edit page if the field is a READ ONLY field.

Sergey Kornilov admin 12/7/2006

Steve,
I don't see NetworkcarRA# field on RaUnitsReturned edit page.

If you don't need to edit this field proceed to Choose fields tab in ASPRunnerPro and remove this field from the Edit page.

This way you can be sure it's not changed.

S
SteveL author 12/8/2006

Steve,

I don't see NetworkcarRA# field on RaUnitsReturned edit page.

If you don't need to edit this field proceed to Choose fields tab in ASPRunnerPro and remove this field from the Edit page.

This way you can be sure it's not changed.


I dont need to edit the field. I just need to call whatever value that is in the field and send it in a email or text file. Any ideas on how to do this with out using the dict expresion and clearing out the field?
Thanks

S
SteveL author 12/8/2006

Steve,

I don't see NetworkcarRA# field on RaUnitsReturned edit page.

If you don't need to edit this field proceed to Choose fields tab in ASPRunnerPro and remove this field from the Edit page.

This way you can be sure it's not changed.


Also I did remove NetworkcarRA# from the edit field but using dict("NetworkcarRA#") the field still gets wiped out when I hit save. Thus removing my link between master and detail relationship