Announcements
Your syntax is wrong in this part, and that’s what’s causing the error.
In Patch(), the third parameter must be a single record of field/value pairs. You can’t pass ThisRecord separately before the { } block. That’s why you’re getting the “The specified column is not available in this context” error.
ForAll( Filter(gallineitems.AllItems, chkgalcode.Checked = true) As _obj, Patch( 'AP Ledger Assignments', Defaults('AP Ledger Assignments'), { Amount: 200, Invoice: _obj.galheader.Selected, InvoiceLineItem: _obj.'AP Invoice Line Items', // Use column name here LedgerCode: _obj.DataCardValue10.Value } ) )
Note: _obj refers to the current row in the gallery, so whenever you want to access a column or control value from that row, use _obj.ColumnName or _obj.ControlName.
With( {filteredItems: Filter(gallineitems.AllItems, chkgalcode.Checked)}, ForAll( filteredItems, Patch( 'AP Ledger Assignments', Defaults('AP Ledger Assignments'), { Amount: 200, Invoice: galheader.Selected, InvoiceLineItem: 'AP Invoice Line Items', LedgerCode: DataCardValue10.Value } ) ) )
I believe @Kalathiya’s code should work correctly.
For improved readability, we can structure it using the With function:
If( !IsBlank( Trim( PlainText( LookUp( 'DataSource', Country.Value = varCountry && State.Value = varState, Q14 ) ) ) ), true, false )
Patch( 'AP Ledger Assignments', ForAll( Filter( gallineitems.AllItems, chkgalcode.Checked ) As _Data, { Amount: 200.00, Invoice: galheader.Selected, InvoiceLineItem: { Value: _Data.' AP Invoice Line Items', Id: LookUp( 'AP Ledgers', YourLookedUpColumn = _Data.' AP Invoice Line Items ).ID } LedgerCode: DataCardValue10.Value } ) );
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Jump in, show your community spirit, and win prizes!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Valantis 424
WarrenBelz 355 Most Valuable Professional
11manish 290