Hi All,
please tell me how to not insert the duplicate data in database
code:-
{ a!localVariables( /* This variable is used to persist the checkbox on selected items by holding the identifiers of the selected rows. */ local!selection, local!Taglist: rule!tagslistexpression(), local!items, local!assignportfolioid, local!allportfolio: rule!Portfoliomaster_selectAll(), local!Temp, local!selected, local!Portfoliomaster:rule!portfoliomasterexp(), /*local!portfolioid: max(local!Portfoliomaster.portfolioid),*/ /* This variable would be used to pass the full rows of data on the selected items out of this interface, such as to a process model. */ local!selectedEmployees, local!filter: rule!customermasterexpression(tags: local!selectedEmployees.tagname), { a!richTextDisplayField( label: "", labelPosition: "COLLAPSED", value: { a!richTextHeader( text: "" ) } ), a!columnsLayout( columns: { a!columnLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { "Create Portfolios" }, color: "STANDARD", size: "MEDIUM_PLUS", style: { "STRONG" } ) } ), a!columnsLayout( columns: { a!columnLayout( contents: { a!cardLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { "Select tags to divide your customer into portfolios" }, color: "#999999" ), char(10), a!richTextItem( text: { "These selected tags will help us to divide customers into different portfolios on the basis of permutation combination" }, color: "#999999" ) } ), a!gridField( label: "", /* Replace the dummy data with a query, rule, or function that returns a datasubset and uses fv!pagingInfo as the paging configuration. */ data: todatasubset(local!Taglist, fv!pagingInfo ), columns: { a!gridColumn( label: "", sortField: "tagname", value: upper(fv!row.tagname), width: "AUTO" ) }, pageSize: 4, selectable: true, selectionStyle: "ROW_HIGHLIGHT", selectionValue: local!selection, selectionSaveInto: { local!selection, a!save(local!selectedEmployees, append(local!selectedEmployees, fv!selectedRows)), a!save(local!selectedEmployees,difference(local!selectedEmployees, fv!deselectedRows)) /*a!save(local!selectedEmployees,local!selectedEmployees.GroupId : ri!groupid),*/ /*updatearray(local!selectedEmployees, 1, local!selectedEmployees.GroupId = ri!groupid)*/ } ), a!checkboxField( label: "", labelPosition: "ABOVE", choiceLabels: {"Include more tags in the list"}, choiceValues: {1}, saveInto: {}, validations: {} ) }, height: "AUTO", style: "NONE", marginBelow: "STANDARD" ), a!buttonArrayLayout( buttons: { a!buttonWidget( label: "Create", saveInto:{ /*a!forEach(items: local!filter,expression:a!save(local!items, append(local!items,{customerid: local!filter.customernumber[fv!index], portfolioname: local!filter.value[fv!index]}))),*/ a!forEach(items: local!filter,expression:a!save(local!items, append(local!items,{customerid: local!filter.customernumber[fv!index], tag: local!filter.tag.tagname[fv!index], portfolioname: local!filter.value[fv!index], portfolioid: local!filter.customerid[fv!index], tagid: local!filter.tag.tagid[fv!index]}))), /*a!forEach(items: local!Taglist,expression:a!save(local!assignportfolioid, append(local!assignportfolioid,{tagid: local!Taglist.tagid[fv!index], tag: local!Taglist.tag[fv!index]}))),*/ /*a!save(a!forEach(items: local!filter,expression:a!save(local!items, app end(local!items,{customerid: local!filter.customernumber[fv!index], tag: local!filter.tag.tagname[fv!index], portfolioname: local!filter.value[fv!index], portfolioid: local!filter.customerid[fv!index], tagid: local!filter.tag.tagid[fv!index]})))),*/ /*a!save(a!forEach(items: local!selectedEmployees,expression: fv!index),a!save(local!selectedEmployees.GroupId,ri!groupid)),*/ a!writeToDataStoreEntity( dataStoreEntity: cons!portfoliomasterorg, valueToStore: local!items ) }, style: "NORMAL" ) }, align: "END" ) }, width: "WIDE_PLUS" ) } ) }, width: "WIDE_PLUS" ) } ) } ) } ) } )}
thank you
Discussion posts and replies are publicly visible
saveInto:{a!forEach(items: local!filter,expression:a!save(local!items, append(local!items,{customerid: local!filter.customernumber[fv!index], tag: local!filter.tag.tagname[fv!index], portfolioname: local!filter.value[fv!index], portfolioid: local!filter.customerid[fv!index], tagid: local!filter.tag.tagid[fv!index]}))),a!writeToDataStoreEntity(dataStoreEntity: cons!portfoliomasterorg,valueToStore: local!items)
in the above code i am writing the data to DB
Its really difficult to read the code this way. Please make use of the Insert Code option under Insert menu to embed the code.
Thanks Harhsa. Adding to this, a reduced example will save us a lot of time trying to understand your code.