Closed duarteoctavio closed 1 year ago
I wasn't able to get it to work neither having two quantity fields nor using an array instead of a single quantity descriptor.
So you're not creating either of the quantities separately (that is, in a separate POST request) when sending the log, is that correct?
I'm not 100% sure about this, but I believe there is some special sauce to allow at least one quantity to be created with a log just by sending the intended quantity fields as a part of the log's own quantity
field, but I'm not super familiar with how that works, or if it would work for more than one quantity. @mstenta could probably advise on that better.
I'm actually planning to test an implementation of quantities in Field Kit today, so I may discover some tricks in the process and will be happy to share back what I find. If it doesn't work or make sense to do this with subrequests, perhaps we can figure out a better API for quantities, because this will certainly be an issue for potential use cases.
I'm not 100% sure about this, but I believe there is some special sauce to allow at least one quantity to be created with a log just by sending the intended quantity fields as a part of the log's own quantity field, but I'm not super familiar with how that works, or if it would work for more than one quantity. @mstenta could probably advise on that better.
We used to have that in v1, but we don't anymore. Now you are expected to create any entity you want to reference before you reference it.
I'm fine creating the quantities first. I don't know how to relate preexisting entities in a subrequest, is that possible? Can you give me a simple example?
Greg and I are working on the conventions
idea and I want to wrap it as much as possible against the subrequests format.
Yes that should be possible. I don't know if I have an example offhand but I'll see if I can dig one up. I know Manuel and Greg had done this a lot already with code in SurveyStack so you may be able to ask them for examples too.
I have examples from Manuel and Greg about linking stuff and I know how to do that, but they directly used JSONAPI. I would like to use the subrequests feature in FarmOS.js. This can still transform a lot of queries into just two or three (quantities first, then everything else).
By the way, I created subreuqests documentation based on the examples in Jamie's tests, Can I submit it, @jgaehring ? Should I create a branck and ask for a merge request so you can review it?
By the way, I created subreuqests documentation based on the examples in Jamie's tests, Can I submit it, @jgaehring ? Should I create a branck and ask for a merge request so you can review it?
That sounds great! I can sit in on your regular team standup tomorrow, too, to catch up on where you all are at, or do a separate call with you if that's preferable.
Question:
Is there a way to relate two
quantities
to the samelog
? We will need to do this fairly often, and I wasn't able to get it to work neither having twoquantity
fields nor using an array instead of a single quantity descriptor.An Example
We need to express data about tillage in FarmOS. What we need to register about a
log--activity
for a tillage event is represented by three magnitudes: The stir rate, the depth and the mass of residue. Is it currently possible to submit the trhee of them at the same time, or should I be a little hacky about it? (for example, creating two of the quantities before).