Match values in datatable?

Hello,

I have two datatables and I would like to match the values in it in order to get the relevant data

I have this table with the data I will need to use depending on parameters

Country Air Transport Sea Transport Arrival Airport Departure Port Arrival Port City City (bis) Road Transport
CHINA 170502 161998 145106 145731 145722 SHANGHAI
SINGAPORE 120791 120791 145723 145731 145723
JAPAN 170502 173327 145157 145731 145819 TOKYO HANEDA
SOUTH KOREA 100566 12791 144944 145731 145699 INCHEON
RUSSIA 170584

I need to match the country and the shipment type

For example:

If my shipment is going to CHINA, through Boat, I will need

The row for China, the code for sea transport as well as the departure and arrival ports + the cities

if it’s china by plane:

  • I will need the codes for the airports + the cities

If it’s russia then it’s only by road and I will need the code.

Basically I need the codes for the corresponding transportation and any corresponding data that is not empty

I will have a second table to match a code with the corresponding type

02 : ROAD
01 : PLANE
03 : BOAT

How can I achieve this please?

Thank you

You can probably use a verification on an “IF clause” that if the input is “Sea” you retrieve certain columns from your data table and do the same for the “Air” transportation method.

Let me know if this helps,
Cheers! :slight_smile:

Hi,

I think it’s necessary to clarify your requirement such as expected output.
However, how about the following sample?

dr = dt.AsEnumerable.Where(Function(r) r(0).ToString=strCountry).FirstOrDefault

then

strCountry+vbcrlf+strTransporation+vbcrlf+String.Join(",",dict(strTransporation).Select(Function(s) dr(s).ToString))

image

Sample
Sample20231011-1L.zip (9.9 KB)

Regards,

Hi @adext ,

You can create a switch case for all of the shipment types and inside the switch case, you can use a Filter Data Table activity in order to get all the records for the country.
Example:
Case : Road
Filter Data Table (Country Variable)

Case : Plane
Filter Data Table (Country Variable)

Case : Boat
Filter Data Table (Country Variable)