Skip to main content
Answer

Row Selected Customization - POReceipt

  • October 10, 2023
  • 6 replies
  • 98 views

Forum|alt.badge.img

I need get “CSAnswer.Value” to “PORecieptLine” Using row selected. How can i achived that.

 

This is the value I want

CSAnswer.value

I want get CSAnswer.value to Cuztomized feild.

 

this is my code. Not give correct result.

 

Best answer by praveenpo

Updated parameter

CSAnswers cSAnswers =
new PXSelectJoin<CSAnswers,
InnerJoin<InventoryItem, On<InventoryItem.noteID, Equal<CSAnswers.refNoteID>>>,
Where<CSAnswers.attributeID, Equal<Required<CSAnswers.attributeID>>,
And<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>>
(Base).Select("AttribuetID",row.InventoryID);

6 replies

praveenpo
Semi-Pro III
Forum|alt.badge.img+3
  • Semi-Pro III
  • October 10, 2023

hi @tharinduweerasooriya90,

Issue is with your query  Join condition

you should Join Noteid column from InventoryItem table to RefNoteID column from CSAnswers and AttributeID should be Required Parameter or if it is always one you can have a satatic class and pass the value in query.
 
 


Forum|alt.badge.img

hi @tharinduweerasooriya90,

Issue is with your query  Join condition

you should Join Noteid column from InventoryItem table to RefNoteID column from CSAnswers and AttributeID should be Required Parameter or if it is always one you can have a satatic class and pass the value in query.
 
 

Is this correct ?

CSAnswers cSAnswers =
new PXSelectJoin<CSAnswers,
InnerJoin<InventoryItem, On<InventoryItem.noteID, Equal<CSAnswers.refNoteID>>>,
Where<CSAnswers.attributeID, Equal<Required<CSAnswers.attributeID>>,
And<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>>
(Base).Select(row.InventoryID);

 


praveenpo
Semi-Pro III
Forum|alt.badge.img+3
  • Semi-Pro III
  • Answer
  • October 10, 2023

Updated parameter

CSAnswers cSAnswers =
new PXSelectJoin<CSAnswers,
InnerJoin<InventoryItem, On<InventoryItem.noteID, Equal<CSAnswers.refNoteID>>>,
Where<CSAnswers.attributeID, Equal<Required<CSAnswers.attributeID>>,
And<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>>
(Base).Select("AttribuetID",row.InventoryID);

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • October 10, 2023

Hi @tharinduweerasooriya90 ,

Don't use the code in the Row Selected event. Instead, add the code in the InventoryID field updated event.

I assume that you are utilizing the defaultRowMatrixAttributeID to retrieve the pallet type. Ensure to join with the InventoryItem noteID field, CsAnswers refnoteid, and also the attributeID.

Please refer the below sample code.
 

 protected virtual void POReceiptLine_InventoryID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null) return;
            POReceiptLine row = (POReceiptLine)e.Row;


            CSAnswers answers = PXSelectJoin<CSAnswers, InnerJoin<InventoryItem, On<CSAnswers.refNoteID, Equal<InventoryItem.noteID>,And<CSAnswers.attributeID, Equal<InventoryItem.defaultRowMatrixAttributeID>>>>,
                                  Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>.Select(Base, row.InventoryID);
            if (answers!=null)
            {
                POReceiptLineExtn extn =row.GetExtension< POReceiptLineExtn >().Fieldname = answers.Value
               
            }

        }


Forum|alt.badge.img

Updated parameter

CSAnswers cSAnswers =
new PXSelectJoin<CSAnswers,
InnerJoin<InventoryItem, On<InventoryItem.noteID, Equal<CSAnswers.refNoteID>>>,
Where<CSAnswers.attributeID, Equal<Required<CSAnswers.attributeID>>,
And<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>>
(Base).Select("AttribuetID",row.InventoryID);
using PX.Data;
using PX.Objects.CS;
using PX.Objects.IN;

namespace PX.Objects.PO
{
public class POReceiptEntry_Extension : PXGraphExtension<PX.Objects.PO.POReceiptEntry>
{

#region Event Handlers
protected void POReceiptLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{

var row = (POReceiptLine)e.Row;

if (row == null) return;


CSAnswers cSAnswers =
new PXSelectJoin<CSAnswers,
InnerJoin<InventoryItem, On<InventoryItem.noteID, Equal<CSAnswers.refNoteID>>>,
Where<CSAnswers.attributeID, Equal<Required<CSAnswers.attributeID>>,
And<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>>
(Base).Select("AttribuetID", row.InventoryID);


if (cSAnswers != null)
{
POReceiptLineExt pOReceiptLineExt = PXCache<POReceiptLine>.GetExtension<POReceiptLineExt>(row);
pOReceiptLineExt.UsrPalletType = cSAnswers.AttributeID;
cache.SetValueExt<POReceiptLineExt.usrPalletType>(row, pOReceiptLineExt.UsrPalletType);

}

}
}
#endregion
}

Still couldn’t get the value


praveenpo
Semi-Pro III
Forum|alt.badge.img+3
  • Semi-Pro III
  • October 10, 2023

Check the parameter you are passing as

AttribuetID

 
Pass the actual Attribute in that place