Dear OpenForis team,

I would like to have plot coordinates presented by default according to strata and plots. For this, I am using a function 'idm:samplingPointCoordinate(strata, plot)' in a 'plot_coordinate' attribute. However, with a change of stratum and plot id, plot coordinates do not change. Where did I make a mistake?

Besides, I need to have a list of available plot ids per stratum (one stratum can have several plots). Thus, a plot attribute is defined as 'calculated' with the following function: 'idm:samplingPointData('plot', strata). In this case, drop down plot window is not active. What is wrong here?

I would appreciate your help very much. Cheers, Roksolana

asked 19 Apr '22, 10:28

petrovska's gravatar image

petrovska
112
accept rate: 0%


Dear Roksolana,
The problem with the default value is that it is evaluated once when the field where it's defined is created, so in your case it is evaluated when the fields strata and plot are still blank.
What you could do is to add an "Apply if" condition to the default value expression to evaluate it when both strata and plot are filled; the expression could be something like:

idm:not-blank(strata) and idm:not-blank(plots)

Then, if you need to have a list of available plot ids per stratum, you need to define a hierarchical code list where you have stratum at the first level and plot ids at the second level, then you could make your stratum attribute in the survey a code attribute that uses the list you have just created and add use the same list for the "plot_id" attribute, but selecting "stratum" as parent code attribute.
I hope it's clear now, please let us know if you need further help.
Thanks,
Open Foris Team

permanent link

answered 19 Apr '22, 11:30

Stefano%20%28OF%29's gravatar image

Stefano (OF) ♦♦
4.8k119
accept rate: 19%

Dear Roksolana,
We will contact you to your private email address to better understand your problem.
Many thanks,
Open Foris Team

permanent link

answered 19 Apr '22, 22:37

Stefano%20%28OF%29's gravatar image

Stefano (OF) ♦♦
4.8k119
accept rate: 19%

Dear Roksolana,
Please make your attribute in the survey designer not "calculated" and keep the same expression in the Default Values. With the expression you are using a calculated attribute won't work (at least with the current version of Collect).
Many thanks,
Open Foris Team

permanent link

answered 20 Apr '22, 16:07

Stefano%20%28OF%29's gravatar image

Stefano (OF) ♦♦
4.8k119
accept rate: 19%

Thank you for your hints, I fixed my issues.

Now I have another problem with circular dependency. How to resolve it?

Circular dependency found in graph for node /strata/plots/height[2]/tree_id java.lang.IllegalStateException: Circular dependency found in graph for node /strata/plots/height[2]/tree_id at org.openforis.idm.model.DependencyGraph$GraphSorter.visit(DependencyGraph.java:385) at org.openforis.idm.model.DependencyGraph$GraphSorter.visit(DependencyGraph.java:391) at org.openforis.idm.model.DependencyGraph$GraphSorter.visit(DependencyGraph.java:391) at org.openforis.idm.model.DependencyGraph$GraphSorter.sort(DependencyGraph.java:378) at org.openforis.idm.model.CalculatedAttributeDependencyGraph.getSortedDependentItems(CalculatedAttributeDependencyGraph.java:30) at org.openforis.idm.model.DependencyGraph.getDependentNodes(DependencyGraph.java:148) at org.openforis.idm.model.DependencyGraph.dependenciesForItems(DependencyGraph.java:137) at org.openforis.idm.model.DependencyGraph.dependenciesFor(DependencyGraph.java:129) at org.openforis.idm.model.Record.determineCalculatedAttributes(Record.java:400) at org.openforis.collect.model.RecordUpdater.recalculateDependentCalculatedAttributes(RecordUpdater.java:468) at org.openforis.collect.model.RecordUpdater.initializeEntity(RecordUpdater.java:879) at org.openforis.collect.model.RecordUpdater.addEntity(RecordUpdater.java:202) at org.openforis.collect.model.RecordUpdater.addNode(RecordUpdater.java:179) at org.openforis.collect.command.handler.AddNodeCommandHandler.executeForResult(AddNodeCommandHandler.java:16) at org.openforis.collect.command.handler.AddNodeCommandHandler.executeForResult(AddNodeCommandHandler.java:9) at org.openforis.collect.command.handler.RecordCommandHandler$1$1.execute(RecordCommandHandler.java:72) at org.openforis.concurrency.Worker.run(Worker.java:103) at org.openforis.concurrency.Job.runTask(Job.java:95) at org.openforis.concurrency.Job.execute(Job.java:80) at org.openforis.concurrency.Worker.run(Worker.java:103) at org.openforis.concurrency.SimpleJobManager$2.run(SimpleJobManager.java:120) at org.springframework.core.task.SimpleAsyncTaskExecutor$ConcurrencyThrottlingRunnable.run(SimpleAsyncTaskExecutor.java:286) at java.lang.Thread.run(Thread.java:748)

permanent link

answered 19 Apr '22, 15:58

petrovska's gravatar image

petrovska
112
accept rate: 0%

thank you, I corrected it as you suggested! Everything works fine.

permanent link

answered 20 Apr '22, 16:24

petrovska's gravatar image

petrovska
112
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×494

question asked: 19 Apr '22, 10:28

question was seen: 788 times

last updated: 20 Apr '22, 16:24