我有下面的考试系数表。
val_disp | val_ret
%0 | 0
%10 | 0.1
%20 | 0.2
%30 | 0.3
%40 | 0.4
%50 | 0.5
%60 | 0.6
%70 | 0.7
%80 | 0.8
%90 | 0.9
%100 | 1
然后在这些选择列表中将这些值列为lov
是否可以级联这些值以总计%100?例如...如果我为期中选择%30,为期末选择%40,则可以通过汇总2个项目值来将分配的最大可用值级联到%30?
在SQL查询中如何使用所选列表项的val_ret?
还是我真的错了吗?
答案 0 :(得分:1)
将“级联LOV父项”属性设置为以前的LOV。
在LOV查询中,引用先前设置的值。
例如:
LOV_1 :
public ActionResult Index([Bind(Include = "location_id,location_name")] Location location)
{
string full_path = Request.MapPath("~/App_Data/TestText.txt");
if (System.IO.File.Exists(full_path))
{
if (new System.IO.FileInfo(full_path).Length > 0)
{
string[] text_file = System.IO.File.ReadAllLines(HostingEnvironment.MapPath(@"~/App_Data/TestText.txt"));
foreach (string record in text_file)
{
string[] record_cell = record.Split('~');
location.location_name = record_cell[1];
db.Locations.Add(location);
db.SaveChanges();
}
System.IO.File.WriteAllText(HostingEnvironment.MapPath(@"~/App_Data/TestText.txt"), "");
}
}
ViewBag.location_id = new SelectList(db.Locations, "location_id", "location_name");
return View();
}
LOV_2 :级联LOV为LOV_1
@Html.DropDownList("location_id", null, htmlAttributes: new { @class = "form-control"})
LOV_3 :级联的LOV为LOV_1和LOV_2
select '%' || 10 * (level - 1) val_disp,
(level - 1) / 10 val_ret
from dual
connect by level <= 11;