Skip to main content
Answer

Accessing data of current record via BQL

  • July 19, 2021
  • 4 replies
  • 587 views

xkylewrightx
Varsity III
Forum|alt.badge.img

Hi,

Appologies if this question is not clear, I am still learning -- I am trying to extend the SOOrderEntry graph and need to create a SelectFrom query that uses as a parameter the OrderNbr of the Sales Order that is currently opened by the user for editing. Is there a way to access this?

I have tried:

 public SelectFrom<WorkflowVars>.Where<WorkflowVars.refordernbr.IsEqual<Current<SOLine.orderNbr>>>.View WorkflowVars;

Among other similar queries, with no luck.

If it is helpful, the error I am getting with the above query is 

The type 'PX.Data.Current<PX.Objects.SO.SOLine.orderNbr>' cannot be used as type parameter 'TOperand' in the generic type or method 'BqlOperand<WorkflowVars.refordernbr, IBqlString>.IsEqual<TOperand>'. There is no implicit reference conversion from 'PX.Data.Current<PX.Objects.SO.SOLine.orderNbr>' to 'PX.Common.IImplement<PX.Data.BQL.IBqlEquitable>'.

Which I believe is because ‘Current’ is returning Null, but just a guess.

 

Any guidance would be much appreciated!!!

Best answer by Naveen Boga

Hey @xkylewrightx  Can you please try below View and check once.

 

public PXSelect<WorkflowVars, Where<WorkflowVars.refordernbr, Equal<Current<SOLine.ordernbr>>>> WorkflowVars;

 

It would be recommended have the OrderType also in the condition.

 

4 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • July 19, 2021

Hey @xkylewrightx  Can you please try below View and check once.

 

public PXSelect<WorkflowVars, Where<WorkflowVars.refordernbr, Equal<Current<SOLine.ordernbr>>>> WorkflowVars;

 

It would be recommended have the OrderType also in the condition.

 


xkylewrightx
Varsity III
Forum|alt.badge.img
  • Author
  • Varsity III
  • July 19, 2021

Hey @xkylewrightx  Can you please try below View and check once.

 

public PXSelect<WorkflowVars, Where<WorkflowVars.refordernbr, Equal<Current<SOLine.ordernbr>>>> WorkflowVars;

 

It would be recommended have the OrderType also in the condition.

 

 

This works! Thank you so much for the prompt and helpful response. Is there any way you can help me understand the difference between what you did and what I tried?


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • July 19, 2021

Hi @xkylewrightx  Please find the difference and syntaxissue.

Your Query

  public SelectFrom<WorkflowVars>.Where<WorkflowVars.refordernbr.IsEqual<Current<SOLine.orderNbr>>>.View WorkflowVars;

 

Modified above query and below both queries are working fine.

public SelectFrom<WorkflowVars>.Where<WorkflowVars.refordernbr.IsEqual<SOLine.orderNbr.FromCurrent>>.View WorkflowVars;

OR

public PXSelect<WorkflowVars, Where<WorkflowVars.refordernbr, Equal<Current<SOLine.ordernbr>>>> WorkflowVars;

      


xkylewrightx
Varsity III
Forum|alt.badge.img
  • Author
  • Varsity III
  • July 19, 2021

@Naveen B I see now, thank you again for your help