When working with data directly from databases you can have some data that needs some decoding. For example, Microsoft GP tables, you know that the column names and data returned is in its raw format which is not good for displaying on a list. Popdock has the power that allows you to decode certain data into a more preferred readable format. This will help everyone looking at the list know exactly what the data represents.

For this example, we will be looking at the SOP30200 – Historical Transaction (header) table.

As you can see that the SOPTYPE field is displaying the numerical code that represents SOP Document Types, which are explained below. Inside Microsoft GP you will always see the SOP Document Types as text which is what we also want to see on our lists.

I will show you 3 different ways you can transform the data into the text that easier to read and understand.

Field Type – List

By default, this field is of type ‘Number’.

If you click edit on the ‘SOPTYPE’ field, you can change the Field Type to ‘List’.

Then on the left navigation bar, select ‘List Items’ and click add list item.

Here you transform the number (Item) to the text (Display) you want to see on the list.

Then you repeat that for every Item and Display combination (see SOP Document Types above).

Now you can see the ‘SOPTYPE’ column is much easier to read than the raw data!

Calculated Field – Popdock Script

In your scenario, if for some reason you are not able to change the field type, you can use a calculated field to transform the data to a more readable format.

On the list, add a calculated field. Then click ‘Add function’ and choose ‘Choice’ and ‘Cases’.

The next screen will help walk you through filling out all the fields in an ‘Item/Display’ pattern as we did before:

  • Set TestValue to ‘Field’, then select ‘SOPTYPE’.
  • Set the ‘Item/Display’ for all the SOP Document type.
    • Click the ‘+’ button to add more sections

  • Click Save. This is the result!

NOTE: You can format the formula to help make the formula more readable.

After you add the calculated field to your list, you get the same great readable column as we did with the ‘Field Type – List’.

Calculated Field – C#

This last way is also a calculated field, but you can use C# if that is what you are more familiar with. After you change the ‘Field language’ to ‘C#’ you will notice that the is no ‘Add function’ ability. You just type the script in the ‘Formula’ textbox. With C# formulas it must written as an expression, not a statement. I bring this up because my first thought was to use a C# switch/case statement, but because it is not an expression, this will not work. Instead, we need to use nested ternary operator. Here is what that looks like:

After you add the calculated field to your list, you get the same great readable column as we did with the ‘Field Type – List’ and ‘Calculated Field – Popdock Script’.

You have probably noticed that all three of these approaches give you the same result in the end.  My goal was to give you multiple options so you can choose what works best for you and your situation.

Have questions? Feel free to reach out to us at support@popdock.com.