Fields with formulas not updating in block

Fields with formulas not updating in block

jpCADconsulting
Advocate Advocate
2,012 Views
14 Replies
Message 1 of 15

Fields with formulas not updating in block

jpCADconsulting
Advocate
Advocate

Hiya gang,

I'm working on a block for a client and I've hit a roadblock.

Basically the block is a slope arrow.

Upon insertion the user is prompted for two values stored in attributes:


  • Slope High Point
  • Slope Low Point



What I want is for the slope text in the block to display the slope as a percentage based on this formula:

((HighPoint-Lowpoint)/Distance)*100)

Where Highpoint and Lowpoint are the values entered by the user on insertion and Distance is the value of the Polar Stretch.

I can get Highpoint mnus Lowpoint to work, and I know I can resolve the distance of the stretch parameter, but I can't seem to make the complete formula work.

I can get each step of the formula to work so I have made a test block with multiple attributes, each with one step of the formula, and this works, but when ever you change the any of the values you have to regen like 4 times to get all the formulas to update.

I'd like the slope value to just change as you drag the grip. I'm sure it's just some syntax issue when I'm trying to do it all in one formula.

Block is attached, all attributes visible for troubleshooting sake. They are in the lower left and they represent:


  • High Point of slope (entered by user on insertion)
  • Low point of slope (entered by user on insertion)
  • Difference in height
  • Distance of stretch parameter
  • Slope RAW (Difference in height divided by distance)
  • Slope Percent (Slope RAW x100)



Hope you can shed some light on this for me.

Thanks in advance,

-JP

0 Likes
Accepted solutions (1)
2,013 Views
14 Replies
Replies (14)
Message 2 of 15

ojuris
Advisor
Advisor

see attached

0 Likes
Message 3 of 15

jpCADconsulting
Advocate
Advocate

Thanks ojuris!

 

I'm taking my wife to a doctor's appointment at the moment but I'll test later today.

 

Much appreciated!

0 Likes
Message 4 of 15

Libbya
Mentor
Mentor

  • High Point of slope (entered by user on insertion)
  • Low point of slope (entered by user on insertion)
  • Difference in height
  • Distance of stretch parameter
  • Slope RAW (Difference in height divided by distance)
  • Slope Percent (Slope RAW x100)

I don't see how that described formula can give the both the correct numerical result AND the correct visual result considering you have both the high point/low point entered by the user AND you have the polar parameter that allows adjustment of both angle and length.  The way you state the formula above, it seems that the 'stretch parameter' should only change the horizontal linear distance and the change in height would be entered as inputs in order to determine the angle of the arrow and the value of the slope.  Instead, the block allows the user to adjust the arrow angle, the arrow length, AND input the high/low values in a manner that would contradict the angle they selected using the polar grip.   

0 Likes
Message 5 of 15

jpCADconsulting
Advocate
Advocate
It's a plan graphic, so the angle of the line does not matter, it's only
the distance between the two points that is used in the calculation.

Sorry, should have been clear about that.
0 Likes
Message 6 of 15

Libbya
Mentor
Mentor

Ah, I see.  Thanks.  

 

The issue in your original block that required the multiple regens was due to the fact that you had an attribute that had a formula field referencing another attribute value.  You then had another attribute with a formula field that referenced that last attribute value, etc...  The first attribute value is updated with a regen.  The next attribute value required a second regen because the value seen within the formula was not updated until the first regen was complete, etc...  The cure is to avoid those progressive formulas and instead have each formula reference only values that are updated immediately (e.g. the blockplaceholder distance and the initial high/low attribute values).

0 Likes
Message 7 of 15

jpCADconsulting
Advocate
Advocate

So I guess I need to be a bit more clear. Sorry folks.

 

The trouble I was having originally was getting this calculation to work with one formula, so I broke it into separate attributes just to see if I could get it to work at all.

Whenever I try to make one formula, it does not work at all.  I assume I must be lacking some bit of knowledge about the syntax of formulae in the field dialog box.  It should be simple enough:

 

((Highpoint - Lowpoint)/distance1 value)*100

 

@ojuris - I don't see any difference in your block. It does the same thing and I have to regen multiple times to get the result to display. Did I miss somersetting?

 

Thanks everyone for your help.

0 Likes
Message 8 of 15

Libbya
Mentor
Mentor

 

0 Likes
Message 9 of 15

ojuris
Advisor
Advisor


@ojuris - I don't see any difference in your block. It does the same thing and I have to regen multiple times to get the result to display. Did I miss somersetting?

 


In my block version you change lowpoint or highpoint or both attributes values and regen 1 time. After this slope value above arrow updated. Or I don't understand what you need?

0 Likes
Message 10 of 15

Libbya
Mentor
Mentor

 

@ojuris , I think the issue is that it appears that you changed the attribute value in model space rather than changing it within the block definition.  Because of that, new insertions behave exactly as before.  

 

@jpCADconsulting, the step-by-step screencast I posted shows how to get the block to work correctly upon insertion.  

 

 

0 Likes
Message 11 of 15

jpCADconsulting
Advocate
Advocate

That is correct. I do not want my staff to have to go into the block editor to change the value of the high and low point attribute values.

 

They should be able to change those values by double-clicking the blocks.

I think I introduced a good deal of confusion by posting my test block with the separate attributes instead of the block i was struggling with.  I will post that block shortly.

0 Likes
Message 12 of 15

jpCADconsulting
Advocate
Advocate

OK attached is the original (non functioning) block.

 

It has 2 attributes only:

 

  • High Point
  • Low Point

The text on the slope line contains a field that is a formula:

((Highpoint value-lowpoint value)/distance1)100

 

It works (or doesn't) like this:

 

  1. Insert the block
  2. User is prompted to enter the value for High Point
  3. User is prompted to enter the value for Low Point
  4. Stretch the arrow
  5. The formula should calculate the slope percent based on entered info and the length of Distance1

Hope this clears things up. And thanks all for your help.

 

 

0 Likes
Message 13 of 15

Libbya
Mentor
Mentor

Does the step-by-step screencast that I posted not show exactly how to do what you are asking for?

0 Likes
Message 14 of 15

Libbya
Mentor
Mentor
Accepted solution

One thing I have found is that sometimes editing the attribute value does not work, especially with formula fields that reference nested field values.  It is often required to delete the attribute field value, save the attribute, then reinsert the field value.  Here is another screencast using your last posted block and showing exactly how to get it to work the way you are asking.  I even demonstrate the correct behavior of each input at the end of the screencast.  

0 Likes
Message 15 of 15

jpCADconsulting
Advocate
Advocate

Ah... I missed th alatt part.  It was indeed a syntax issue.

It seems like the formula is read straight left to right and I had some unneeded parenthesis in there that may have been messing with things a bit.

 

Thanks!!! Testing now!

0 Likes