Skip to content
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

Update single flows in process #29

Open
dontoasty opened this issue Sep 21, 2021 · 2 comments
Open

Update single flows in process #29

dontoasty opened this issue Sep 21, 2021 · 2 comments

Comments

@dontoasty
Copy link

dontoasty commented Sep 21, 2021

Hi,
I am trying to update a single flow inside a process, e.g. to adjust the amount or even delete it from the process. The way I am doing it right now, is to create a new exchange list and update the whole process. That way, all unchanged flows have to be part of the new exchange list again, though.
Is there a way to only change certain flows within a process? Something like

process = client.get(olca.Process, 'fb0d68e9-9a14-431b-ac34-1f9a14c18de8') 

for "flow" in process:
       if flow.id = "dc50a884-b2f5-4c95-9912-07b8dfb2d497":
           flow.amount = 5

client.update(process)

Thanks for any hints!

@msrocka
Copy link
Member

msrocka commented Sep 24, 2021

Something like this should work:

import olca

client = olca.Client()
process = client.get(olca.Process, '0b62c9f4-5d2e-42fb-a32b-310b3f493e5f')

for e in process.exchanges:
  if e.flow.id == '8772a1a2-9a23-c6bf-8a87-4800c60f4e87':
    e.amount = 5

client.update(process)

@dontoasty
Copy link
Author

Great, thank you very much, it worked! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants