Skip to main content
Answer

Drop Down Field Values in Reports

  • March 17, 2022
  • 1 reply
  • 157 views

Michaelh
Pro I
Forum|alt.badge.img+2

I have a user defined drop down field. I want to show the display values, not the stored variable values. When I run a GI, I get the values that my users see. When I run a report, I get the underlying variables.

Here is my setup:

[PXDBString(20)]
[PXUIField(DisplayName="Routed")]
[PXStringList(
new string[] { "", "NA", "TD", "SR", "92", "LA", "TPS", "TPL", "TPN", "TGP", "TGS", "BD"}, 
new string[] { "", "N/A", "Troutdale", "92nd BLDG 3", "92nd BLDG 4",  "LA 3PL", "TP Seattle", "TP LA/LB", "TP New York", "TGR PDX", "TGR SeaTac", "Boyd 3PL"})]

 

When I call the field UsrRouted in a GI I get the bottom string as expected (Like “Troutdale). When I call the field in the report writer, I get the field codes from the first string (Like “TD”). How do I get the display codes from the 2nd string in a report? I can make an abomination of an “IF” statement, but that’s not the right answer, because it can’t be scaled.

 

Thanks Everyone!

Best answer by mcraig95

You could try the Switch construct? Which is like a case or goto.  It can grow and is much more readable for a complex statement.  Matt

 

1 reply

Forum|alt.badge.img+1
  • Varsity I
  • Answer
  • April 17, 2023

You could try the Switch construct? Which is like a case or goto.  It can grow and is much more readable for a complex statement.  Matt