+1 vote
641 views
Hi y'all.

I might be pushing openLCA to its limits. But I'm trying to create some dependent parameters based on which country/region (in the world, so 200+) I am modelling.

I made a selector/switch; easy.. just an index, where I wrote the country name for each index in the description,

BUT(!!!)

When making dependant parameters on more than a houndred countries/regions, I reach the character limit of 1000, using if-statements.

I generated a recursive functing in python creating a string with countryIndex and the countries population.. the syntax is like so:

if(Country=1;42239854;if(Country=2;2832439;if(Country=3;45606481; ... ;0))) ... )

Where the larger values are population count for each country/region)

This easily runs up to 4-5000 characters!

I would naturally rather use some more fitting function, but am at a loss with what openLCA allows.

I need to make many other country-specific parameters

Does anyone know a proper workaround, to allow me to select a bunch of values dependent on a selection of about 200 values?

Best,

Simon
in openLCA by (790 points)

1 Answer

+1 vote
by (14.0k points)
selected by
 
Best answer
The current maximum length of 1000 characters for a formula is probably really a bit small. You can increase that limit by executing the SQL statement below in the openLCA SQL editor. The maximum size for a VARCHAR is 32672 in Derby; a CLOB could be used for larger sizes:

ALTER TABLE tbl_parameters ALTER COLUMN formula SET DATA TYPE VARCHAR(32672);

edit: always make a backup of your important database before trying this!
by (790 points)
Thank You msrocka, this was a perfect answer!

For all the fellow learners out there:

In openLCA: click "tools" -> "Developer tools" -> "SQL"
Then  insert the command  given by msrocka in "SQL Statement" and run it by clicking the run-icon.
...