This topic is locked

Calculate Lookup field

2/21/2007 6:55:18 AM
ASPRunnerPro General questions
R
rutzi author

Hallo, hallo. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=4665&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />
I have maid 2 table der one of them drag out post from the table inn look up field.

Inn the one table there I won't calculate 2 field, like m2 * price doesn't work.

I don't have any error message but the list page is blank. So is it possible to

Calculate 2 fields that is lookup field? But if I make one of the fields to text field in sted off lockup field is working god. But sins the price is in the one table I wont this to be automatic.
Hope you can help me whit this

J
Jane 2/21/2007

Hi,
to calculate 2 fields use Before record added or Before record updated event.

Here is a sample:

dict("FieldName")=dict("m2")*dict("price")



where Fieldname is your actual field name where resulting value is stored.

R
rutzi author 2/21/2007

Hallo again and thanks.
No I can se the data but the sum field show 0. It doesn't calculate the field I won't.
Here i sthe code i put in
____
Function BeforeEdit(dict, where)
' Parameters:

' dict - Scripting.Dictionary object.

' Each field on the Edit form represented as 'Field name'-'Field value' pair

' where - string with WHERE clause pointing to record to be edited
'** Custom code ****

' dict("SUM")=dict("Enhetspris")*dict("m")
BeforeEdit = True
' set BeforeEdit to True if you like to proceed with editing this record

' set it to False in other case
End Function
What do i wrong????? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=15733&image=1&table=forumreplies' class='bbcemoticon' alt='<<' />

J
Jane 2/22/2007

It seems that you comment code in your event. Delete single quote before your code:

...

'** Custom code ****

dict("SUM")=dict("Enhetspris")*dict("m")

...


If it doen't help publish your project on Demo Account and send to [email=support@xlinesoft.com]support@xlinesoft.com[/email] a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

R
rutzi author 3/12/2007

Hallo again! Tank's for all the help. It's great. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=16173&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
bat I have another question. If I are register data inn the database, and I forget

too put inn a line. Howe can I make that the line coming between 2 lines that already is registered. Hope you can help me whit this too.
Look forward to you answer
Best regards to you

Rune Hagen

Sergey Kornilov admin 3/13/2007

Rune,
not really sure what is the "line that coming between 2 lines".

Probably you can clarify.

R
rutzi author 3/13/2007

Hallo, hallo. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=16192&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
Ok I try to do that.
I use the database to price jobs to the our customers.

I set up a eks here.
Line 1 is something like this
ID 1 / paint a house / kr 10000

ID 2 / Paint a door / Kr 2000

ID 3 / Paint something / Kr 4000
This can go one for 100 of lines.

Sometime we forget something. Lets say I should have I price between

ID 1 an ID 2 that haw to be between this line. What can I do too get lines between

lines. Hope you understood this, and you can help me
Best regards

Rune Hagen

R
rutzi author 3/19/2007

Is it no one ho can help me whit this?????

A
ac163601 3/19/2007

Is it no one ho can help me whit this?????


Rune,

Det har ingeng mening hva line heter, bar ta 'det som du glemmer' til line nummer 4.
Hilsen

Andy

C
clig 3/20/2007

Hallo again and thanks.

No I can se the data but the sum field show 0. It doesn't calculate the field I won't.
Here i sthe code i put in
____
Function BeforeEdit(dict, where)
' Parameters:

' dict - Scripting.Dictionary object.

' Each field on the Edit form represented as 'Field name'-'Field value' pair

' where - string with WHERE clause pointing to record to be edited
'** Custom code ****

' dict("SUM")=dict("Enhetspris")*dict("m")
BeforeEdit = True
' set BeforeEdit to True if you like to proceed with editing this record

' set it to False in other case
End Function
What do i wrong????? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=16404&image=1&table=forumreplies' class='bbcemoticon' alt='<<' />


' dict("SUM")=dict("Enhetspris")*dict("m")

  • this will never execute as written - it's rem'd out...