Hoppa till huvudinnehållet

Updated a feature attribute using business logic (an if-then statement)

Kommentarer

6 kommentarer

  • Gareth Evans

    Hey Brian

    This would be most easily accomplished with an If activity above your Set Feature Attribute(s).

    I have an inspection workflow that I will throw in a bit of logic to match what you are trying to do and share my example in a few minutes here.

     

    0
  • Gareth Evans

    Hey Brian

    I threw a rough example together here, based on an existing inspection workflow with some additonal form elements and logic, here: https://apps.vertigisstudio.com/workflow/designer/#workflow=aa03117445dd408ebf7a88428f2498f4 (openable in SaaS VSWF - let me know if you do not have a license)

    The main piece I want to highlight is here in the Set Attributes container:

    I used two if statements in a chain just to illustrate the logic, though if you wanted to you could build a JavaScript if statement to contain the entirety of your logic in one if.

    0
  • Brian Bulla

    Thanks Gareth, that is amazing!

    No, we don't have the licence, but it prompted me to start a 60 day trial, so once that gets setup I'll log back in and check it out.

    I was hoping to just code it manually, but I'll check out what you have and maybe I can just do it using that IF object.  I'm pretty much a NOOB to VertiGIS Mobile and used to doing everything from scratch in code format.

    Thanks for you help!  I'll report back early next week with my progress.  :-)

    0
  • Gareth Evans

    Hey Brian Bulla 

    In that case, I've just thrown the export of my workflow as JSON on OneDrive here.

    Download that and import it into your on-prem Workflow designer (File > Import) and you can look at my approach.

    If you're used to developing from scratch, Workflow should hopefully allow you to move a little more quickly.

    I'd also suggest, if you have not seen it already have a look at the VertiGIS Studio Mobile SDK developer documentation as there is a fair bit of context in there that may help support your development efforts.

    0
  • Brian Bulla

    Thanks Gareth,

    I've been able to take what you showed and have got the start of it working….so that is good!  Is there a “Code view” option or is everything just done in this “Flowchart” view in Workflow?  For something like this where I have to cascade about 10 or so “IF” statements, it would much faster to just type it in code style like I have above.

    Thanks for your help!

    0
  • Brian Bulla

    OK, so instead of the 10 or 12 IF blocks, I just put them all into 1 as you suggested.  That is way easier to code, and to follow when looking at the workflow.  I'll delete the other ones now that I don't need them.

     

    Still more testing to do, but I think it's working.

    =($inspectionForm.state.raise.value == "WR" || $inspectionForm.state.lower.value == "WR" || $inspectionForm.state.replaceLid.value == "WR" || $inspectionForm.state.replaceFrame.value == "WR" || $inspectionForm.state.replaceBricks.value == "WR" || $inspectionForm.state.resetFrame.value == "WR" || $inspectionForm.state.steps.value == "WR" || $inspectionForm.state.channelOrBenching.value == "WR" || $inspectionForm.state.crackedWalls.value == "WR" || $inspectionForm.state.deterioratedWalls.value == "WR" || $inspectionForm.state.infiltration.value == "WR" || $inspectionForm.state.safetyGrate.value == "WR" || $inspectionForm.state.parging.value == "WR" || $inspectionForm.state.cleaningRequired.value != "NO") && ($inspectionForm.state.txtWorkCompletedDate.value == "")

     

    0

Du måste logga in om du vill lämna en kommentar.