Visualizzazione dei risultati da 1 a 9 su 9
  1. #1

    come ottenere valore da due campi

    Utilizzo MS Access 2003. Una delle tabelle ha i seguenti campi: "RetailBudget" e "BuildCost". Come posso aggiungere un ulteriore campo (solo nella pagina ASP) che mostri il valore che ottengo dividendo RetailBuget/BuildCost = markup

    retailbudget 10000
    buildcost 7500
    markup 1,33 = (10000/7500)

    In altre parole, quando inserisco i due valori vorrei essere in grado di verificare qual e' il markup e se il valore e' soddisfacente salvo il recordset (retailbudget e buildcost).

    Grazie in anticipo per il vs aiuto e suggerimento.

    rick

  2. #2
    i valori RetailBuget e BuildCost li hai già letti dal db o li stai inserendo a video?

  3. #3
    li sto inserendo a video.

  4. #4

  5. #5
    immagino tu faccia un select.. bhè, penso che basti un

    "select * from.... WHERE IS NOT NULL buildcost AND (retailbudget/buildcost)>valore_soddisfacente"

  6. #6
    non vedo come l'espressione SELECT possa aiutarmi.

    credo che ci sia del codice (vbscript or js) da utilizzare. Il problema e' che non so come farlo.

    Qualche idea?

  7. #7
    posta il codice magari

  8. #8
    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

  9. #9
    se sei lato client (editing) - ripeto - è roba per js. chiedi nel forum apposito.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.