Discussions

 View Only
  • 1.  Edit Record on Different Form Based on Field Value

    Posted 11-15-2018 17:46
    I've got an application up that is managing the process flow for one of 6 products.  When you edit a record, obviously you see the form for the table.

    However, I need to be able to create 5 more different forms, and route the 'edit' to that form, based on what value is in the 'product' field.

    I started to use Form Rules, but it's a nightmare trying to hide everything and show everything for all 7 roles.

    How can I click on a record in a report and be transported to the correct form, based on the Product field?


  • 2.  RE: Edit Record on Different Form Based on Field Value

    Posted 11-15-2018 18:11
    No, you cannot. 
    I personally despise multiple forms as its a worse nightmare than form rules.

    So, you choices are to associate your forms with which reports they should be used on (set that in Forms usage, once you have more than 1 form) or else use sections as much as possible and show hide rules on whole sections.  The issue will be to group your common fields data entry fields together if possible as you may only have a data entry field once on a form.



  • 3.  RE: Edit Record on Different Form Based on Field Value

    Posted 12-18-2018 19:20
    Thank you very much for your information.

    I actually submitted another question just a bit ago because I didn't see this response.  I was trying to create an 'if' statement based on product and redirect from there, but I could never get the syntax right.

    Your solution above assumes there are different reports for different products, when in fact it's the same report, but sorted and grouped by product.

    So, it seems the only solution is to create multiple reports and then associate those reports with forms in 'Forms Usage'.  But that means multiple reports on the same page, because each Client Manager work multiple products, and so that means that not everything will be displayed in one neat report on dashboards...resistance will be swift and severe.  But, if it's a limitation, it is what it is, I guess.

    We definitely do have multiple sections on the first product form and I can certainly show/hide based on [PRODUCT].  I was just thinking that an if statement would be much more efficient.



  • 4.  RE: Edit Record on Different Form Based on Field Value

    Posted 12-18-2018 19:54
    Kyle,
    I'm still not understanding the question here.

    Can you just do this?

    We definitely do have multiple sections on the first product form and I can certainly show/hide based on [PRODUCT].  I was just thinking that an if statement would be much more efficient.





  • 5.  RE: Edit Record on Different Form Based on Field Value

    Posted 12-18-2018 19:40
    Try this using a single Rich Text Formula Field named [Button]:
    "<a class='QBU_Button Vibrant Success'" &
    " data-rid='" & [Record ID#] & "'" &
    " data-product='" & [Product] & "'" &
    " onerror='
    (async () => { let dbidTable = 'your table dbid';
      let rid = this.dataset.rid;
      let product = this.dataset.product;
      let map = {
        'sproket': '10',
        'widget',  '11',
        'thingamajig', '12'
      };   let dfid = map[product];
      let url = '${dbidTable}?a=er&rid=${rid}&dfid=${dfid}';
      document.location.href = url;
      window.open(url);
    })();
    '>Button</a>"
    You will need to adjust the map to conform to your product's and dfid's. My mappings act like this:

    if [Product] = 'sproket' open form with dfid=10
    if [Product] = 'widget' open form with dfid=11
    if [Product] = 'thingamajig' open form with dfid=12

    Note that this formula uses the 3Q&S Technique and employs three different quote characters:

    (1) double quotes are used to delimit the formula text
    (2) single quotes are used to delimit the <a> elements attributes
    (3) back tick quotes are used as the quote character within the JavaScript.

    I did not test this but I think it is correct as is.


  • 6.  RE: Edit Record on Different Form Based on Field Value

    Posted 01-24-2022 22:52
    Edited by Matt Stephens 01-24-2022 22:53
    Just create a rich text button on your report with coding like this:

    var text buttonstuff = "<a class='Vibrant Danger' href='" & URLRoot() & "db/" & Dbid() & "?a=er&rid="& [Record ID#];
    
    Case(  [status],
    "1. Draft",
        $buttonstuff & "&dfid=11" & "'>Submit it</a>",
    "2. Submitted",
        $buttonstuff & "&dfid=10" & "'>Review it</a>",
    "3. Reviewed",
        $buttonstuff & "&dfid=13" & "'>Approve it</a>",
    "4. Approved",
        $buttonstuff & "&dfid=14" & "'>Look at it</a>"
    )



    ------------------------------
    Matt Stephens
    ------------------------------