Il seguente script creato con ASPRunner prende in considerazione 3 campi: RetailBudget, BuildCost e Markup.
Pensate sia possibile modificare il codice che si riferisce al campo Markkup per far in modo che quest'ultimo prenda il valore da RetailBudget/BuildCost.
Se inserisco RetailBudget: 10000
e BuildCost: 5000
automaticamente il campo Markup diventa 10000/5000 = 2
Grazie per qualsiasi suggerimento
rick
if IsUpdatable(rs.Fields("RetailBudget")) then
nType = GetFieldType(strTableName, "RetailBudget")
' boolean
if nType=11 or (nType=131 and Left(GetRequestForm("RetailBudget"),1)="o") then
if GetRequestForm("RetailBudget")="on" then
strValue="1"
else
strValue="0"
end if
else ' not boolean
if GetRequestForm("RetailBudget")="" and ( nType=72 or nType=133 or nType=134 or nType=135 ) then
strValue = NULL
else
strValue=GetRequestForm("RetailBudget")
' date edit convert
if GetEditFormat("RetailBudget")=EDIT_FORMAT_DATE or IsDateFieldType(nType) then
strValue= FormatDbDate(strValue, DateEditType("RetailBudget"))
end if
if IfNeedQuotes(GetFieldType(strTableName, "RetailBudget"))<>"True" or IsDateFieldType(GetFieldType(strTableName, "RetailBudget")) then
if strValue="" then
strValue=Null
end if
end if
if IsFloat(nType) and strValue<>"" then
strValue = Replace(strValue, ",", ".")
end if
end if
end if
dict.Add "RetailBudget", strValue
if GetEditFormat("RetailBudget")=EDIT_FORMAT_FILE then
if GetRequestForm("typeRetailBudget") = "upload2" then
rs("RetailBudget")= strValue
if strValue<>"" then _
WriteToFile Server.MapPath(GetUploadFolder("RetailBudget") & strValue), GetRequestForm("fileRetailBudget")
end if
elseif GetEditFormat("RetailBudget")<>FORMAT_DATABASE_IMA GE and GetEditFormat("RetailBudget")<>FORMAT_DATABASE_FIL E then
rs("RetailBudget") = strValue
else
if GetRequestForm("typeRetailBudget") = "file1" or GetRequestForm("typeRetailBudget") = "file2" then
If IsNull(strValue) or GetRequestForm("typeRetailBudget") = "file1" Then
rs("RetailBudget") = Null
Else
rs("RetailBudget").AppendChunk strValue
End If
end if
end if
end if
if IsUpdatable(rs.Fields("BuildCost")) then
nType = GetFieldType(strTableName, "BuildCost")
' boolean
if nType=11 or (nType=131 and Left(GetRequestForm("BuildCost"),1)="o") then
if GetRequestForm("BuildCost")="on" then
strValue="1"
else
strValue="0"
end if
else ' not boolean
if GetRequestForm("BuildCost")="" and ( nType=72 or nType=133 or nType=134 or nType=135 ) then
strValue = NULL
else
strValue=GetRequestForm("BuildCost")
' date edit convert
if GetEditFormat("BuildCost")=EDIT_FORMAT_DATE or IsDateFieldType(nType) then
strValue= FormatDbDate(strValue, DateEditType("BuildCost"))
end if
if IfNeedQuotes(GetFieldType(strTableName, "BuildCost"))<>"True" or IsDateFieldType(GetFieldType(strTableName, "BuildCost")) then
if strValue="" then
strValue=Null
end if
end if
if IsFloat(nType) and strValue<>"" then
strValue = Replace(strValue, ",", ".")
end if
end if
end if
dict.Add "BuildCost", strValue
if GetEditFormat("BuildCost")=EDIT_FORMAT_FILE then
if GetRequestForm("typeBuildCost") = "upload2" then
rs("BuildCost")= strValue
if strValue<>"" then _
WriteToFile Server.MapPath(GetUploadFolder("BuildCost") & strValue), GetRequestForm("fileBuildCost")
end if
elseif GetEditFormat("BuildCost")<>FORMAT_DATABASE_IMAGE and GetEditFormat("BuildCost")<>FORMAT_DATABASE_FILE then
rs("BuildCost") = strValue
else
if GetRequestForm("typeBuildCost") = "file1" or GetRequestForm("typeBuildCost") = "file2" then
If IsNull(strValue) or GetRequestForm("typeBuildCost") = "file1" Then
rs("BuildCost") = Null
Else
rs("BuildCost").AppendChunk strValue
End If
end if
end if
end if
if IsUpdatable(rs.Fields("Markup")) then
nType = GetFieldType(strTableName, "Markup")
' boolean
if nType=11 or (nType=131 and Left(GetRequestForm("Markup"),1)="o") then
if GetRequestForm("Markup")="on" then
strValue="1"
else
strValue="0"
end if
else ' not boolean
if GetRequestForm("Markup")="" and ( nType=72 or nType=133 or nType=134 or nType=135 ) then
strValue = NULL
else
strValue=GetRequestForm("Markup")
' date edit convert
if GetEditFormat("Markup")=EDIT_FORMAT_DATE or IsDateFieldType(nType) then
strValue= FormatDbDate(strValue, DateEditType("Markup"))
end if
if IfNeedQuotes(GetFieldType(strTableName, "Markup"))<>"True" or IsDateFieldType(GetFieldType(strTableName, "Markup")) then
if strValue="" then
strValue=Null
end if
end if
if IsFloat(nType) and strValue<>"" then
strValue = Replace(strValue, ",", ".")
end if
end if
end if
dict.Add "Markup", strValue
if GetEditFormat("Markup")=EDIT_FORMAT_FILE then
if GetRequestForm("typeMarkup") = "upload2" then
rs("Markup")= strValue
if strValue<>"" then _
WriteToFile Server.MapPath(GetUploadFolder("Markup") & strValue), GetRequestForm("fileMarkup")
end if
elseif GetEditFormat("Markup")<>FORMAT_DATABASE_IMAGE and GetEditFormat("Markup")<>FORMAT_DATABASE_FILE then
rs("Markup") = strValue
else
if GetRequestForm("typeMarkup") = "file1" or GetRequestForm("typeMarkup") = "file2" then
If IsNull(strValue) or GetRequestForm("typeMarkup") = "file1" Then
rs("Markup") = Null
Else
rs("Markup").AppendChunk strValue
End If
end if
end if
end if

Rispondi quotando
VVoVe:
:master:
