-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add global parameter #20
Comments
Hello, As my first approach I followed an example this link:
but it failed to create database and there is this report in console 'create new database jdbc:derby:/Applications/openLCA.app/Contents/MacOS/C:/Users/astupratiwi/openLCA-data-1.4/databases/Krigsheim;create=true' As a second attempt, I tried to add those global parameters to a process by running this code several time
It worked, but as soon as I delete the parameters from the list of input parameter of that process "p1", the parameters are gone from the list of the global parameters. Does anyone know how to solve this issue? Astu |
As you are on macOS Also, you do not attach global parameters to a process. Because when you delete from org.openlca.core.model import Parameter, ParameterScope
from org.openlca.core.database import ParameterDao
# create a global input paramater
param = Parameter()
param.name = "global_p"
param.scope = ParameterScope.GLOBAL
param.isInputParameter = True
param.value = 5
# create the paramater DAO and insert the paramater in
# the database
dao = ParameterDao(db)
dao.insert(param) |
Hello,
I am a beginner in terms of using Python for OpenLCA.
I have a list of 70 parameters (in excel) that I would like to add as global parameters in my database and I would like to add it using Python code.
As my first approach I followed an example this link:
https://github.com/GreenDelta/openlca-python-tutorial/blob/master/examples.md
`from java.io import File
from org.openlca.core.database.derby import DerbyDatabase
from org.openlca.core.database import ParameterDao
if __name__ == '__main__': db_dir = File('C:/Users/astupratiwi/openLCA-data-1.4/databases/Krigsheim') db = DerbyDatabase(db_dir) dao = ParameterDao(db) param = dao.getForName('k_B')[0] param.value = 42.0 dao.update(param) db.close()
but it failed to create database and there is this report in console 'create new database jdbc:derby:/Applications/openLCA.app/Contents/MacOS/C:/Users/astupratiwi/openLCA-data-1.4/databases/Krigsheim;create=true'
As a second attempt, I tried to add those global parameters to a process by running this code several time
It worked, but as soon as I delete the parameters from the list of input parameter of that process "p1", the parameters are gone from the list of the global parameters.
Does anyone know how to solve this issue?
thank you so much!
Astu
The text was updated successfully, but these errors were encountered: