Trying to create a new row with the only two required fields my logan_prodData table needs: dateAdded and JobID (FK to logan_jobs). I'm getting the error: table id=ProductionData - Column 'jobID' in field list is ambiguous
What am I doing wrong?
Controller:
using (var db = new Database(settings.DbType, settings.DbConnection))
{
var response = new Editor(db, "logan_prodData", "recordID")
.Model<ProductionJobsDataModel>()
.Field(new Field("logan_prodData.PComp")
.Validator(Validation.Numeric()))
.Field(new Field("logan_prodData.CurEstEndDate")
.GetFormatter(Format.DateSqlToFormat("MM/d/yyyy"))
.SetFormatter(Format.DateFormatToSql("MM/d/yyyy")))
.Field(new Field("logan_prodData.PMEnd")
.GetFormatter(Format.DateSqlToFormat("MM/d/yyyy"))
.SetFormatter(Format.DateFormatToSql("MM/d/yyyy")))
.Field(new Field("logan_prodData.recordID"))
.Field(new Field("logan_prodData.jobID"))
.Field(new Field("logan_prodData.deptID")
.Options("logan_dept", "deptID", "department")
.Validator(Validation.DbValues()))
.Field(new Field("logan_jobs.jobNumber"))
.Field(new Field("logan_jobs.customer"))
.Field(new Field("logan_jobs.plannerID")
.Options("logan_user", "userID", "fullName", q => q.Where("deptID", "1", "="))
.Validator(Validation.DbValues()))
.Field(new Field("logan_jobs.description"))
.Field(new Field("logan_jobs.partNumber"))
.Field(new Field("logan_user.fullName"))
.Field(new Field("logan_status.status"))
.Field(new Field("logan_status.displayColor"))
.Field(new Field("logan_dept.department"))
.LeftJoin("logan_jobs", "logan_jobs.jobId", "=", "logan_prodData.jobId")
.LeftJoin("logan_dept", "logan_dept.deptID", "=", "logan_prodData.deptID")
.LeftJoin("logan_status", "logan_status.statusID", "=", "logan_prodData.statusID")
.LeftJoin("logan_user", "logan_user.userID", "=", "logan_jobs.plannerID")
.Process(request)
.Data();
JS to create row onClick:
$('#ProductionData tbody').on('click', 'a.editor_create', function (e) {
e.preventDefault();
var cellContents = table.cell( ($(this).closest('tr').next('tr')),1).data()
editor
.create(false)
.val('logan_prodData.jobID', cellContents)
.val('logan_prodData.dateAdded', Date.now())
.submit();
});