Solved

Using SWITCH to use another field name if first field is null or empty

  • 18 April 2024
  • 3 replies
  • 47 views

Userlevel 4
Badge

We have a Generic Inquiry that has the Customer.ParentAccountID and not all of the parent accounts have that that number all by itself (the account number also, in some cases, has the name of the customer). I was thinking in that case to use a SWITCH similar to the one here:

=IIF([Customer.ParentBAccountID] = ' ', [Customer.AcctCD]) but that is not working also. Also I am not sure if the Customer.ParentAccountID is empty or NULL. I know that the Customer.ParentAccountID should be showing up because when I do a CRTL+ALT the Element property shows the field as Customer.AcctCD. I also thought about getting just the number portion of the AcctCD but that seems more work then necessary. I could use any suggestions that the Community may have.There are accounts whereby the Customer.ParentBAccountID is showing up correctly on that column.

In this case the Customer.ParentBAccountID = ‘ ‘ or NULL and the customer.AcctCD is 16310 - Grainer.

 

icon

Best answer by BenjaminCrisman 18 April 2024, 21:40

View original

3 replies

Userlevel 7
Badge +4

Hi @wmatthews1877! I would recommend to just add a field and see what the output of [Customer.ParentBAccountID] is.

You can add the Len() function to it to see if there is some blank character or something

I don’t know if it matters or not, but using ‘ ‘ instead of ‘’ might make a difference also (omitting the space between the single quotes).

Userlevel 4
Badge +1

I’m not sure I follow but if you’re trying to have a column that displays the Customer.AcctCD except when there is a parent account and in that case display the Parent’s Customer.AcctCD, then I think your trouble might be that the Customer.ParentAccountID is not the same as the Customer.AcctCD of the parent account

 

Try joining PX.Objects.CR.BAccount to the PX.Objects.AR.Customer table where parentBAccountID equals bAccountID

 

And then use =isNull([BAccountR.AcctCD],[Customer.AcctCD])

 


 

 

Userlevel 4
Badge

That worked perfectly. Thank you and stay safe!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved