ProfessionistiDIT
19/10/2022 11:19
|
ProfessionistiDIT
istruzione select case utilizzata in script ready pro
domanda semplice e precisa (sicuramente dovuta alla non grande conoscenza della programmazione in sè ed alla non profonda conoscenza anche di ready pro)
perchè se viene scritto uno script in questo modo:
Select Case Product.CustomField(700) Case Is <= 1 Response.Write(FormatCurrency(Product.SellingPrice(8, True).Price)) Case Is <= 2 Response.Write(FormatCurrency(Product.SellingPrice(9, True).Price)) Case Is <= 3 Response.Write(FormatCurrency(Product.SellingPrice(7, True).Price)) Case Is <= 4 Response.Write(FormatCurrency(Product.SellingPrice(10, True).Price)) Case Is <= 5 Response.Write(FormatCurrency(Product.SellingPrice(11, True).Price)) Case Is <= 10 Response.Write(FormatCurrency(Product.SellingPrice(12, True).Price)) Case Else Select Case Product.ProdCategory.Id Case 241, 246, 258, 348, 498, 538, 614, 625, 1000, 1005, 1192, 1325, 1327, 1395, 1433, 1526, 1696, 1697, 1698, 1715, 1725, 1740, 1742, 1746, 1859, 1875, 1887 Response.Write(Replace(FormatCurrency(Product.SellingPrice(2, True).Price),"'",".")) Case Else Response.Write(Replace(FormatCurrency(Product.SellingPrice(1, True).Price),"'",".")) End Select End Select
non funziona (viene riportato un errore di sintassi sia per quanto riguarda l'istruzione case is, sia per quanto riguarda gli operatori <= piuttosto che < o =)
mentre se il medesimo script viene scritto in questo modo:
If Rdy.toDouble(Product.CustomField(700)) <= 1 Then Response.Write(FormatCurrency(Product.SellingPrice(8, True).Price)) ElseIf Rdy.toDouble(Product.CustomField(700)) <= 2 Then Response.Write(FormatCurrency(Product.SellingPrice(9, True).Price)) ElseIf Rdy.toDouble(Product.CustomField(700)) <= 3 Then Response.Write(FormatCurrency(Product.SellingPrice(7, True).Price)) ElseIf Rdy.toDouble(Product.CustomField(700)) <= 4 Then Response.Write(FormatCurrency(Product.SellingPrice(10, True).Price)) ElseIf Rdy.toDouble(Product.CustomField(700)) <= 5 Then Response.Write(FormatCurrency(Product.SellingPrice(11, True).Price)) ElseIf Rdy.toDouble(Product.CustomField(700)) <= 10 Then Response.Write(FormatCurrency(Product.SellingPrice(12, True).Price)) Else Select Case Product.ProdCategory.Id Case 241, 246, 258, 348, 498, 538, 614, 625, 1000, 1005, 1192, 1325, 1327, 1395, 1433, 1526, 1696, 1697, 1698, 1715, 1725, 1740, 1742, 1746, 1859, 1875, 1887 Response.Write(Replace(FormatCurrency(Product.SellingPrice(2, True).Price),"'",".")) Case Else Response.Write(Replace(FormatCurrency(Product.SellingPrice(1, True).Price),"'",".")) End Select End If
funziona perfettamente ma è noto che la condizione if then else è molto meno efficiente
siamo noi che sbagliamo qualcosa nello scrivere il primo script, e non sappiamo cosa ciò dovuto al fatto di essere fondamentalmente degli autodidatti, oppure è il vostro sistema che non gestisce il case is e gli operatori nelle istruzioni select case?
cordiali saluti
|