Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Is it possible to create a scriptable object in the MathCad sheet that controls whether an area shall be collapsed or expanded in the sheet.
area is-collapsed="true"
vs
area is-collapsed="false"
I’ve tried to explain the “wanted” feature in attached file.
Solved! Go to Solution.
I think the most useful example is one from Tom Gutmaan, which shows how to define varibles by changing the XML.
One way to solution your problem!
Sometime we need show in Mathcad-sheet one formulas or other formulas.
One example on Mathcad Server
http://twtmas.mpei.ac.ru/mas/Worksheets/IF_in_WorkSheet.mcd
The tip of this task: change PICTURAS with formulas.
One Picture may be empty - showes no information.
It is "collapsed area"
Thanks for the tip, I think i get the picture , but it doesn't solve my "problem".
Is it possible to create a scriptable object in the MathCad sheet that controls whether an area shall be collapsed or expanded in the sheet.
No. I have wanted to do this as well, but unfortunately it is not possible.
Ok too bad, but now i know.
You could use a conditional statements through a scripted component.
Not the best, but will work.
Mike
You can't open or close areas from within a scripted component.
I know this can't be done.
The whole reason the application is needed is to display something depending on a result. This could be done using a conditional statement scripted component.
Pity Mathcad can't call Mathcad regions from seperate sheets.
Mike
Mike Armstrong wrote:
You could use a conditional statements through a scripted component.
Yes Valery this is exactly what I was talking about. I have a few examples, but was waiting to see if there was any interest.
You can also use value.visible depending on a condition.
Mike
Mike Armstrong wrote:
Yes Valery this is exactly what I was talking about. I have a few examples, but was waiting to see if there was any interest.
You can also use value.visible depending on a condition.
Mike
But using pictures for formula, backcolor etc changing in Work Sheet is more simple and more usefull.
See one practical MathcadWebSheet from my WebReference Book:
http://twtmas.mpei.ac.ru/mas/Worksheets/Hydro/GDF.mcd
and a picture as copy (when Mathcad Server is breack - sorry from my but more from PTC):
Valery we are on the same page, maybe my description is not sufficient.
I will create a worksheet later and post with my ideas.
Mike
Hi Valery and Mike, thanks for the useful input.
But based on the thread from Mike about "conditional statements", I think my MathCad sheet is misleading (sorry for that).
In my sheet, I will have about seven sub-calculations, each having separate input values.
The final result will be a summation of the sub-calculations.
But if a input-value to a sub-calculation is = 0 then all "in-between" calculation in that sub-calcultaion will result in = 0.
So then I will have about three pages showing calculations= 0.
i.e. two input values = 0, then 3+3 pages showing calculations = 0 etc. etc.
But which input values that will be = 0, is different each time.
Therefore I thought putting each sub-calculation in an "Area", to minimize the amount of pages to print, and collapsing and expanding them depending if the input-value would be equal to 0.
That's why I thought it would be great to control each Area automatically within the MathCad sheet.
/Anders
But based on the thread from Mike about "conditional statements", I think my MathCad sheet is misleading (sorry for that). In my sheet, I will have about seven sub-calculations, each having separate input values.
The final result will be a summation of the sub-calculations.
But if a input-value to a sub-calculation is = 0 then all "in-between" calculation in that sub-calcultaion will result in = 0.
So then I will have about three pages showing calculations= 0.
i.e. two input values = 0, then 3+3 pages showing calculations = 0 etc. etc.
But which input values that will be = 0, is different each time.
Therefore I thought putting each sub-calculation in an "Area", to minimize the amount of pages to print, and collapsing and expanding them depending if the input-value would be equal to 0.
So basically if a sub-calculation is 0 you do not wish to display those equations relating to that specific sub-calculation?
There might be other ways to achieve this.
Mike
Hi Mike,
Yes, if the input to a sub-calculation is = 0, then I whish it would be possible to not display those equations, and still get a printable report.
I’ve enclosed a new version of my sheet, in order to be more specific of my wanted feature.
You got my attention with, “There might be other ways to achieve this.”.
Is it possible to get an example?
/Anders
I sugggest a different approach,
Now that you have a working routing, translate each subsection into a program. You can put all the intermediate results, if you want to see, into a nested array returned by each program, or into a single array, which you can then parse, or provide table headings, however you wish. In the programs you can test for 0 and output just one value or string true, and the array if not.
Wayne
Hi Wayne,
I understand what you say/text regarding the function of the finished “program”.
But how I get there, is way beyond my MathCad knowledge (as of today)
Can you provide me with a hands-on example or point me in a direction where to look.
/Anders
Anders,
Something like the attached revision.
You may be able to make better use of indices in the calculations, in any case, would need to change to indices in the calculations after the sub-calculations.
Wayne
Wayne, thank you for your time and effort.
I’ll study your suggestion and alter my sheet.
/Anders
If you put your values in to matrices then it is simple to index through the columns using a range variable. You then have one set of caclulations, and it's trivial to extend it from 3 columns to 7.
Richard, I appreciate your input in this matter and the time you have spent trying to help me.
I’ll study your suggestions as well.
/Anders
I am massively surprised this cant be done.
Mike
Do you mean you are surprised that Mathsoft/PTC didn't provide a way to do it, or that you are actually surprosed it can't be done?
Do you mean you are surprised that Mathsoft/PTC didn't provide a way to do it, or that you are actually surprosed it can't be done?
Not really suprised Mathsoft or PTC haven't provided a way to do it, but I am suprised that it can't be done.
Mike
There is no direct programmatic access to an area.
I can look at the region properties in a VBscript, but those properties do not even include information about whether it is collapsed or open, let alone allow me to change that.
I can change the XML of a region from within a VBscript, but that is only possible for math regions, and an area is not a math region.
So I see no way to do this.
There is no direct programmatic access to an area.
I can look at the region properties in a VBscript, but those properties do not even include information about whether it is collapsed or open, let alone allow me to change that.
I can change the XML of a region from within a VBscript, but that is only possible for math regions, and an area is not a math region.
So I see no way to do this.
I knew if it could be done, it would of by now. Maybe put this request this the 'What do you want in Prime'
Mike
Mike and Richard, thanks for the time answering my question.
I got a little bit curious about, " I can change the XML of a region from within a VBscript, .... "
Is there an example here in the "community" about this matter?
I think the most useful example is one from Tom Gutmaan, which shows how to define varibles by changing the XML.
Thanks.
/Anders