Hi, I have a text field in dynamic grid layout. How do i check for a duplicate entry and generate a error message in validation?
(I'm storing the entries from the text field in a rule input of cdt type)
Discussion posts and replies are publicly visible
Can you please share the code for this
Unknown said:Can you please share the code for this
FYI this is a super-old thread - nearly 5 years now - if you're having a specific issue, it might be appropriate to start your own new post now if there are no other/more recent threads that seem to deal with your issue.
Hi Arpit
a!localVariables( local!data:rule!D_Demo_excel_Data(data:ri!input), { a!gridLayout( label: "Student Data", labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell(label: "Roll_No"), a!gridLayoutHeaderCell(label: "Name"), a!gridLayoutHeaderCell(label: "Subject_1"), a!gridLayoutHeaderCell(label: "Subject_2"), a!gridLayoutHeaderCell(label: "Subject_3"), a!gridLayoutHeaderCell(label: "Subject_4"), a!gridLayoutHeaderCell(label: "Total_Percentage"), a!gridLayoutHeaderCell(label: "Grade"), }, columnConfigs: {}, rows: { a!forEach( items: ri!data, expression: a!localVariables( a!gridRowLayout( contents: { a!integerField( value: fv!item.Roll_No, saveInto: fv!item.Roll_No, readOnly: true ), a!textField( value: fv!item.Name, saveInto: {fv!item.Name,a!save(fv!item.Total_Percentage,{((fv!item.Subject_1) + (fv!item.Subject_2) + (fv!item.Subject_3) + (fv!item.Subject_4) )/4}),a!save(fv!item.Grade,rule!D_excelGrade(percentage: fv!item.Total_Percentage))}, required: true ), a!integerField( value: fv!item.Subject_1, saveInto: {fv!item.Subject_1,a!save(fv!item.Total_Percentage,{((fv!item.Subject_1) + (fv!item.Subject_2) + (fv!item.Subject_3) + (fv!item.Subject_4) )/4}),a!save(fv!item.Grade,rule!D_excelGrade(percentage: fv!item.Total_Percentage))}, required: true ), a!integerField( value: fv!item.Subject_2, saveInto: {fv!item.Subject_2,a!save(fv!item.Total_Percentage,{((fv!item.Subject_1) + (fv!item.Subject_2) + (fv!item.Subject_3) + (fv!item.Subject_4) )/4}),a!save(fv!item.Grade,rule!D_excelGrade(percentage: fv!item.Total_Percentage))}, required: true ), a!integerField( value: fv!item.Subject_3, saveInto: {fv!item.Subject_3,a!save(fv!item.Total_Percentage,{((fv!item.Subject_1) + (fv!item.Subject_2) + (fv!item.Subject_3) + (fv!item.Subject_4) )/4}),a!save(fv!item.Grade,rule!D_excelGrade(percentage: fv!item.Total_Percentage))}, required: true ), a!integerField( value: fv!item.Subject_4, saveInto: {fv!item.Subject_4,a!save(fv!item.Total_Percentage,{((fv!item.Subject_1) + (fv!item.Subject_2) + (fv!item.Subject_3) + (fv!item.Subject_4) )/4}),a!save(fv!item.Grade,rule!D_excelGrade(percentage: fv!item.Total_Percentage))}, required: true ), a!integerField( value: {((fv!item.Subject_1) + (fv!item.Subject_2) + (fv!item.Subject_3) + (fv!item.Subject_4) )/4}, /*saveInto:fv!item.Total_Percentage,*/ readOnly: true(), required: true ), a!textField( value: rule!D_excelGrade(percentage:fv!item.Total_Percentage), /*saveInto:fv!item.Grade,*/ readOnly: true(), required: true ), } ) ) ) }, selectionSaveInto: {}, validations: {}, shadeAlternateRows: true ), a!buttonArrayLayout( buttons: { a!buttonWidget( label: "save", submit: true, style: "NORMAL" ) }, align: "START" ) } )
I am Getting the data from a excel file and writing it to the DB. but i want to check for duplicate, like if users enters the same record they must not be written in to the DB.