Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic updating query

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
spackle42
327 Views, 4 Replies

iLogic updating query

I have six user multivalue parameters (top_reel_1 - top_reel_6).  I've written a loop that works its way through these parameters moving the contents upward so that there are never any empty ("N/A") parameters above a filled one.  The loop works as expected, with one exception.  When a parameter is changed in the drop down box, the rule moves it to the correct position but then doesn't change the original cell to empty.

Dim i As Integer
For i = 1 To 6
    If top_reel_6 = "N/A" Then
    Else
        If top_reel_5 = "N/A" Then
            top_reel_5 = top_reel_6
            top_reel_6 = "N/A"
        End If
    End If
    
    If top_reel_5 = "N/A" Then
    Else
        If top_reel_4 = "N/A" Then
            top_reel_4 = top_reel_5
            top_reel_5 = "N/A"
        End If
    End If
    
    If top_reel_4 = "N/A" Then
    Else
        If top_reel_3 = "N/A" Then
            top_reel_3 = top_reel_4
            top_reel_4 = "N/A"
        End If
    End If
    
    If top_reel_3 = "N/A" Then
    Else
        If top_reel_2 = "N/A" Then
            top_reel_2 = top_reel_3
            top_reel_3 = "N/A"
        End If
    End If
    
    If top_reel_2 = "N/A" Then
    Else
        If top_reel_1 = "N/A" Then
            top_reel_1 = top_reel_2
            top_reel_2 = "N/A"
        End If
    End If
Next i


Justin Smith

Inventor Pro 2015 SP1
HP Z400 Workstation
Intel Xeon W3565 @ 3.20GHz
12Gb RAM
Win 7 64 Pro SP1
Spacepilot Pro v3.17.4
4 REPLIES 4
Message 2 of 5
adam.nagy
in reply to: spackle42

Hi Justin,

 

I could not reproduce the behaviour with the part document I created:

http://www.screencast.com/t/zH8A6ctfz

 

Please have a look at it to see if it works for you too.


Cheers,



Adam Nagy
Autodesk Platform Services
Message 3 of 5
spackle42
in reply to: adam.nagy

Thanks for taking the time to look into this Adam.  Sorry I haven't replied sooner but I got dragged off to other projects.  I tried the file that you posted but it seems to do the same thing.  I start with all fields filled as below.

Step 1.JPG

 

I change top_reel_4 to 'N/A' and the table updates to:

Step 2.JPG

 

And then updates again after a mouse click to:

Step 3.JPG

 

What I'm attempting to achieve is that when I start with (1,2,3,4,5,6) and change 4 to N/A for example, the result should be (1,2,3,5,6,N/A), not (1,2,3,6,N/A,N/A) as above.



Justin Smith

Inventor Pro 2015 SP1
HP Z400 Workstation
Intel Xeon W3565 @ 3.20GHz
12Gb RAM
Win 7 64 Pro SP1
Spacepilot Pro v3.17.4
Message 4 of 5
spackle42
in reply to: adam.nagy

EDIT: I've just noticed that you have been using a form instead of changing the parameter directly in the parameter window.  I will try setting up a form and see how that works.

 

I've tidied up the code to make it a little easier to follow and makes the For loop redundant:

 

If Not(top_reel_2 = "N/A") And top_reel_1 = "N/A" Then
    top_reel_1 = top_reel_2
    top_reel_2 = "N/A"
End If

If Not(top_reel_3 = "N/A") And top_reel_2 = "N/A" Then
    top_reel_2 = top_reel_3
    top_reel_3 = "N/A"
End If

If Not(top_reel_4 = "N/A") And top_reel_3 = "N/A" Then
    top_reel_3 = top_reel_4
    top_reel_4 = "N/A"
End If

If Not(top_reel_5 = "N/A") And top_reel_4 = "N/A" Then
    top_reel_4 = top_reel_5
    top_reel_5 = "N/A"
End If

If Not(top_reel_6 = "N/A") And top_reel_5 = "N/A" Then
    top_reel_5 = top_reel_6
    top_reel_6 = "N/A"
End If

 

The issue seems to be that the code is not initially able to update the field that has been modified by the user, so it copies the 'N/A' value to the field below (and cycles that value on down the list) but then the original field is still left as 'N/A' as well.  It then runs the rule a second time for some reason and moves the erroneous value in the original field to the bottom of the list as well, which results in the two 'empty' fields instead of just one.  



Justin Smith

Inventor Pro 2015 SP1
HP Z400 Workstation
Intel Xeon W3565 @ 3.20GHz
12Gb RAM
Win 7 64 Pro SP1
Spacepilot Pro v3.17.4
Message 5 of 5
spackle42
in reply to: adam.nagy

It works fine if I use a form to enter the information


Justin Smith

Inventor Pro 2015 SP1
HP Z400 Workstation
Intel Xeon W3565 @ 3.20GHz
12Gb RAM
Win 7 64 Pro SP1
Spacepilot Pro v3.17.4

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report