Solved

Write into excel from multiply parameters and variables

  • 15 September 2022
  • 2 replies
  • 27 views

Badge

Hello,

I have a question related to writing a result to excel. I know how to write a matrix from a single parameter to excel, however I have trouble constructing a single table where all values match. If I have a parameter location(city, xy), where city is a set’s list, while xy has two columns (latitude, longitude), and I would like to combine with parameter Client(city,client), and parameter DistanceClient(city, distance), and parameter ClientDemand(client, poroductdemand), how do I save this data into one table where the rows and columns match?

NOTE: each city has different number of clients: city1 has 4 clients, while, city2 has 8 clients, etc.

How to obtained the following matrix in excel that looks like this:

               latitude     longitude    client     distance   productdemand  

city1

city2

city3

….

cityn
 

 

I’m really appreciate your help :)

Kind regards

icon

Best answer by MarcelRoelofs 16 September 2022, 17:30

View original

2 replies

Userlevel 3
Badge +5

Hi @ndmile 

I'm a little bit unclear what you're trying to achieve here. 

Is it your intention to have a new row for every city,client combination as determined by Client(city,client)? If so, do you want to have the longitude and latitude duplicated, for each client? I could potentially see this for outputting the data, but what if you want to read this and the longitude and latitudes have different values for the same city and different clients? 

I think you have fundamentially two tables: 

  • One over cities, defining the longitude and latitude
  • One over cities and clients, defining distance and product demand.

This should be straightforward to generate.

If you still are intent in outputting the data in your given format, I think the easiest approach would be to create identifiers Location1(city,client,xy) === Location(city,xy)DistanceClient(city,client) and DemandClient(city,client). You can then easily use the Data Exchange library to create the excel sheet you're after, using to binds-to columns for city and client, a name-binds-to column for Location1, and two maps-to columns for DistanceClient and DemandClient.

I'll leave it up to you to create the mapping.

Badge

Thank you Marcel, I will try as you suggest.

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator