...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<Macro Name="CreateGreenhouse"> <Argument> <Greenhouses></Greenhouses> </Argument> <Result> <SetLocalData key="Greenhouses"> <Value> <Include>$Macro.Argument.Greenhouses</Include> </Value> </SetLocalData> <for each="record" in="Greenhouse" from="$LocalData.Greenhouses" using="$ProcessData"> <JavaScript> var NumberOfLanes = [:$ProcessData.record.NumberOfLanes:]; var ZonesPerLane = [:$ProcessData.record.ZonesPerLane:]; var NumberOfZones = NumberOfLanes * ZonesPerLane; sffContext.execute("SetLocalData","key","NumberOfZones","value",NumberOfZones); </JavaScript> <!-- Create Query for Greenhouse --> <SetContextData key="FirstLane"> <Value>Yes</Value> </SetContextData> <For each="laneRecord" in="Lane" from="$ProcessData.record.Lanes" using="$LocalData"> <!-- Add Lanes --> <addLanes> <GreenhouseID>[:$ContextData.GreenhouseID:]</GreenhouseID> <LaneName>[:$LocalData.laneRecord.LaneName:]</LaneName> <LaneLength>110</LaneLength> <LaneWidth>40</LaneWidth> <ZoneInLane>[:$ProcessData.record.ZonesPerLane:]</ZoneInLane> <BorderLane>No</BorderLane> </addLanes> <if condition="$Response.Message.Value/Create/Status eq 'Success'"> <then> <SetLocalData key="LaneID"> <Value>[:$Response.Message.Value.Create.Lane.LaneID:]</Value> </SetLocalData> <loadZoneModels> <LaneID>[:$LocalData.LaneID:]</LaneID> <ZonesPerLane>[:$ProcessData.record.ZonesPerLane:]</ZonesPerLane> <CropType>[:$LocalData.laneRecord.CropType:]</CropType> <FirstLane>[:$ContextData.FirstLane:]</FirstLane> </loadZoneModels> </then> </if> <SetContextData key="FirstLane"> <Value>No</Value> </SetContextData> </For> </then> </if> </for> </Result> </Macro> |
Load Zone Models
Data is randomized and generated
...