Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG, Page 727 of 795  Not logged in ELOG logo
ID Date Icon Author Author Emailup Category OS ELOG Version Subject
  1779   Thu Mar 23 21:52:03 2006 Reply Steve Jonessteve.jones@freescale.comRequestLinux Re: implement 'hide attribute' and 'sort attribute'
> > > Only the sorting (of the entry mask!) is missing! :)
> > 
> > Ok, I put that on my wish list. So once the second or third person asks for it, I will
> > implement it (;-)
> 
> I'm asking! :-)
> 
> I have a few Extendable Options attributes, and it would be extremely nice if they got sorted as users put them 
> in. So that when you select the drop-down box, alle options are sorted.
> 
> 
> Lars

Agreed - that would be nice
  1785   Mon Apr 3 16:31:37 2006 Question Steve Jonessteve.jones@freescale.comQuestionAll2.6Numerous questions that I am hoping to get a response on
Stefan, I have several issues/questions that I am still hoping to get an answer on. Any chance? If you would rather you can send email to me directly.

Thanks

Steve
  1787   Mon Apr 3 16:39:33 2006 Agree Steve Jonessteve.jones@freescale.comQuestionAll2.6Re: Numerous questions that I am hoping to get a response on

Steve Jones wrote:

Stefan Ritt wrote:

Steve Jones wrote:
Stefan, I have several issues/questions that I am still hoping to get an answer on. Any chance? If you would rather you can send email to me directly.


I'm pretty busy these days, since we have a deadline on April 18th. I started already working weekends, so not much time is left for ELOG. But I hope it will get better by the end of this month.


I fully understand and appreciate your response!
  1789   Tue Apr 4 06:18:18 2006 Question Steve Jonessteve.jones@freescale.comRequest 2.6.1Simple math within an elog form
This may sound a little strange but I am trying to determine if it is possible to create a series of attributes that may be assigned an integer value via OPTIONS, and then take the selected values and perform some simple math and display the result. For example:

What we are trying to do is create a simple form that helps a person assign a risk value to a series of identified risks

Attributes = risk1, risk2, risk3, totalrisk
Type risk1 = numeric
Type risk2 = numeric
Type risk3 = numeric

OPtions risk1 = 10, 20, 30
Options risk2 = 10, 20 , 30
OPtions risk3 = 10, 20 , 30

Subst totalrisk = $risk1+$risk2+$risk3

I suppose I could use $shell to do this but I was trying to stay away from $shell for security reasons.

Thanks
  1792   Wed Apr 5 00:00:14 2006 Reply Steve Jonessteve.jones@freescale.comRequest 2.6.1Re: Simple math within an elog form

Stefan Ritt wrote:

Steve Jones wrote:
This may sound a little strange but I am trying to determine if it is possible to create a series of attributes that may be assigned an integer value via OPTIONS, and then take the selected values and perform some simple math and display the result.


This item is already on the wishlist, so I added your vote there. But due to my workload, it will certainly not be implemented in the next few weeks.



Quote:

Ok, understood. So instead I am trying to use $shell and am running into a problem
##################################################
# Define Risk1
#
Options Risk1 = 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 


##################################################
# Define Risk2
#
Options Risk2 = 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 

##################################################
# Define Risk2
#
Options Risk3 = 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 

##################################################
# Define TotalRisk
#
Subst TotalRisk = $shell(echo $Risk1 + $Risk2 + $Risk3 > /tmp/elog_out)
#Subst TotalRisk = $shell(gawk 'BEGIN{ print $Risk1 + $Risk2 + $Risk3 }' )
#Subst TotalRisk = $shell(uname -a)

What comes out with my simple echo or gawk line is "+ + " so it looks like the attributes are not getting passed into the $shell code?
  1794   Wed Apr 5 13:50:14 2006 Reply Steve Jonessteve.jones@freescale.comRequest 2.6.1Re: Simple math within an elog form

Stefan Ritt wrote:

Steve Jones wrote:
Subst TotalRisk = $shell(echo $Risk1 + $Risk2 + $Risk3 > /tmp/elog_out)

What comes out with my simple echo or gawk line is "+ + " so it looks like the attributes are not getting passed into the $shell code?


The reason is that the substitutions get evaluated from left to right, so first the shell is called with $Risk1, and because the shell by itself does a subsitution and $Risk1 is not defined on the unix system, the shell returns an empty string, leading to "+ +" as the result.

I changed that in the current SVN version, so we have first the attribute substitions, then then shell substitution. The "echo $Risk1..." will of course not work, since it gets substituted by elog as "echo 12 + 23 + 45" (or whatever the numbers are), and the "echo" will just return these numbers without adding them. To make the shell to add things, you would need to define the risks as environment variables for the shell, so I guess the "gawk" method will work better for you. I tried it and it worked fine for me.


Sorry, I waSn't clear about just why I was using "echo". Since elog removes the /tmp/elog_shell temporary file I couldn't "see" what was actually being passed to the shell - gawk was giving me an error and I was flying blind. So I used echo to create my own temporary file.

Yes, gawk should now work -- I'l download and compile the latest and provide feedback.

Thanks!
  1795   Wed Apr 5 18:56:48 2006 Agree Steve Jonessteve.jones@freescale.comRequest 2.6.1Re: Simple math within an elog form

Steve Jones wrote:

Stefan Ritt wrote:

Steve Jones wrote:
Subst TotalRisk = $shell(echo $Risk1 + $Risk2 + $Risk3 > /tmp/elog_out)

What comes out with my simple echo or gawk line is "+ + " so it looks like the attributes are not getting passed into the $shell code?


The reason is that the substitutions get evaluated from left to right, so first the shell is called with $Risk1, and because the shell by itself does a subsitution and $Risk1 is not defined on the unix system, the shell returns an empty string, leading to "+ +" as the result.

I changed that in the current SVN version, so we have first the attribute substitions, then then shell substitution. The "echo $Risk1..." will of course not work, since it gets substituted by elog as "echo 12 + 23 + 45" (or whatever the numbers are), and the "echo" will just return these numbers without adding them. To make the shell to add things, you would need to define the risks as environment variables for the shell, so I guess the "gawk" method will work better for you. I tried it and it worked fine for me.


Sorry, I waSn't clear about just why I was using "echo". Since elog removes the /tmp/elog_shell temporary file I couldn't "see" what was actually being passed to the shell - gawk was giving me an error and I was flying blind. So I used echo to create my own temporary file.

Yes, gawk should now work -- I'l download and compile the latest and provide feedback.

Thanks!


Ok, confirming that this now works. Passing the command:
Subst <attribute> = $shell(gawk 'BEGIN{ print $Attrib1 + $Attrib2 + $Attrib3 }' ) 
will cause the result to be pushed into <attribute>, so gawk in essence becomes a simple calculator and operates on the formula "$Attrib1 + $Attrib2 + $Attrib3".
  1796   Wed Apr 5 20:25:42 2006 Question Steve Jonessteve.jones@freescale.comQuestionAll2.6.1-1684Triggering $shell question
Should this work? rev1684 now allows $shell to pass attribute contents to the shell command and whenever a new entry is submitted or when one Edits/Replys the Subst is triggered, but I would like to be able to trigger this whenever a new value in the options pulldown is selected (assume Risk2 and Risk3 are identical to Risk1). Being able to trigger a regular Preset works fine (like {1} preset Date = $date ) but I would like to trigger the Subst. Maybe a better question, what actions (Subst, Preset, Change, Execute, etc.) I've tried Subst and Preset but not much luck.

##################################################
# Define Risk1
#
Options Risk1 = 10{30}, 20{31}, 30{32}, 40{33}, 50{34}, 60{35}, 70{36}, 80{37}, 90{38}, 100{39} 
{30,31,32,33,34,35,36,37,38,39} Subst TotalRisk = $shell(gawk 'BEGIN{ print $Risk1 + $Risk2 + $Risk3 }' )

ELOG V3.1.5-fe60aaf