Skip to main content
Solved

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

  • April 18, 2024
  • 3 replies
  • 163 views

Forum|alt.badge.img+1

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.

 

Best answer by BenjaminCrisman

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).

View original
Did this topic help you find an answer to your question?

3 replies

BenjaminCrisman
Acumatica Employee
Forum|alt.badge.img+4
  • Acumatica Support Team
  • 691 replies
  • Answer
  • April 18, 2024

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).


Forum|alt.badge.img+1
  • Semi-Pro I
  • 97 replies
  • April 18, 2024

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])

 


 

 


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • 130 replies
  • April 22, 2024

That worked perfectly. Thank you and stay safe!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings