Automate

 View Only
  • 1.  Target a specific row in a repeating table

    Posted 04-13-2023 05:27

    Hello! 

    I hope someone figured this out, because I can't seem to get it working.. 
    I have a repeating table, with checkboxes to select specific rows for an MM01 script. 
    I have a field that only needs to be filled in once, so I have created a "first" marker, so I can skip the rest of the lines.
    I want to be able to mark this "first" marker for the first selected row in the table only.

    Example:

    I have 5 rows. If I select row 2 3 and 4, I only want the "first" field to be filled in for row 2. 
    If I deselect row 2, I want that "first" field to be blanked out for row 2, then filled in for row 3. 

    I've tried creating a custom rule using for (let i=0 ; i<count(myfields); i++) {
    if (field_select == true) && (first_helper)!=true)
    {
    setvalue(repeating_group[x]/my:first_marker);
    }

    Unfortunately, I get an error in the Ctrl+F12 console and it doesn't work.. It looks like it's not swapping the [x] in the setvalue expression with the specific number x would be.. I've tried both repeating_group[x]/my:first_marker and repeating_group/my:first_marker)[x] and none of them work.. 


    Any ideas or help will be greatly appreciated. 

    Thank you! 



    ------------------------------
    Florin Dumitrescu
    Carestream Dental LLC
    Atlanta GA
    ------------------------------


  • 2.  RE: Target a specific row in a repeating table

    Posted 04-14-2023 14:13

    Hi Florin
    Attached is an example of rules where I am setting/clearing a value based on a check box in a repeating table. Maybe it will help you with your rule. I find that with check boxes, having an if "true" or true statement seems to take care of it.



    ------------------------------
    Vanessa Kutasi
    Foundation Admin./Application Analyst II
    Idexx Operations, Inc.
    USA
    ------------------------------

    Attachment(s)

    txt
    If True.txt   722 B 1 version
    txt
    If False.txt   723 B 1 version


  • 3.  RE: Target a specific row in a repeating table

    Posted 04-18-2023 05:45

    Hello Vanessa, 

    Thank you for your help! 
    The problem I was facing was not my logic, apparently, but the syntax (I'm still a beginner when it comes to JavaScript. 
    I was trying to use the variable incorrectly... instead of ...Repeating_Content['+i+'], I was only using ...[i] and Winshuttle was not happy with that. 
    Now everything works wonderfully. 


    Thank you! :)



    ------------------------------
    Florin Dumitrescu
    Carestream Dental LLC
    Atlanta GA
    ------------------------------



  • 4.  RE: Target a specific row in a repeating table

    Posted 04-18-2023 08:22

    I'm glad it helped :) I knew nothing about JavaScript prior to Winshuttle as well! It is certainly a good skill to have in the tool belt!



    ------------------------------
    Vanessa Kutasi
    Foundation Admin./Application Analyst II
    Idexx Operations, Inc.
    USA
    ------------------------------