transport10.cpp File Reference
This is the 10th model in a series of tutorial examples. More...
#include "gams.h"
#include <iostream>
#include <vector>
#include <QAxObject>
#include <Windows.h>
Go to the source code of this file.
Functions | |
GAMSParameter | sheetToParameter (QAxObject *sheets, string sheetName, GAMSDatabase db, string paramName, string paramText, GAMSSet set) |
GAMSParameter | sheetToParameter (QAxObject *sheets, string sheetName, GAMSDatabase db, string paramName, string paramText, GAMSSet set1, GAMSSet set2) |
Detailed Description
This is the 10th model in a series of tutorial examples.
Here we show:
- How to fill a GAMSDatabase by reading from MS Excel
Definition in file transport10.cpp.
Function Documentation
◆ sheetToParameter() [1/2]
GAMSParameter sheetToParameter | ( | QAxObject * | sheets, |
string | sheetName, | ||
GAMSDatabase | db, | ||
string | paramName, | ||
string | paramText, | ||
GAMSSet | set | ||
) |
Creates an 1 dimensional GAMSParameter and transfers data from an Excel sheet (horizontal ordered)
- Parameters
-
sheets The sheets object of an open Excel workbook sheetName The name of the sheet to be read db The GAMSDatabase where the GAMSParameter is created in paramName The name of the new GAMSParameter paramText The explplanatory text of the new GAMSParameter set The GAMSSet for GAMSParameter dimension
- Returns
- The new GAMSParameter in the GAMSDatabase
Definition at line 105 of file transport10.cpp.
◆ sheetToParameter() [2/2]
GAMSParameter sheetToParameter | ( | QAxObject * | sheets, |
string | sheetName, | ||
GAMSDatabase | db, | ||
string | paramName, | ||
string | paramText, | ||
GAMSSet | set1, | ||
GAMSSet | set2 | ||
) |
Creates a 2 dimensional GAMSParameter and transfers data from an Excel sheet
- Parameters
-
sheets The sheets object of an open Excel workbook sheetName The name of the sheet to be read db The GAMSDatabase where the GAMSParameter is created in paramName The name of the new GAMSParameter paramText The explplanatory text of the new GAMSParameter set1 The GAMSSet for first GAMSParameter dimension set2 The GAMSSet for second GAMSParameter dimension
- Returns
- The new GAMSParameter in the GAMSDatabase
Definition at line 136 of file transport10.cpp.
150 string namej = sheet->querySubObject("Cells( int, int )", 1, j)->dynamicCall("Value()").toString().toStdString();
152 string namei = sheet->querySubObject("Cells( int, int )", i, 1)->dynamicCall("Value()").toString().toStdString();
GAMSParameterRecord addRecord(const std::vector< std::string > &keys)
GAMSSetRecord addRecord(const std::vector< std::string > &keys)
GAMSParameter addParameter(const std::string &name, const int dimension, const std::string &explanatoryText="")
void setValue(const double val)