I would like to see if I can figure a way to graph data, even if a simple bar graph for results. But first, I need to figure out the error in the following:
{local sA1, a1, s1="", i=0, imax=0
sA1 = getfield(LIST_OBS("LDL","signed","list","valuedate"),")",HRET)
imax = (if size(sA1)<=10, size(sA1), 10)
s1=""
for i=1,i<=imax,i=i+1 do
a1 = getfield(str(sA1[i]),"(","")
s1=s1+(if s1<>"",HRET,"")+a1[2]+" "+a1[1]
endfor
s1}
Once this works, my plan is to
reverse the printing order (printing oldest first)
then make some kind of bar graph for results
Thoughts?
Has anyone been able to embed graph results into a letter?
Thanks.
joeg1962 said:
I would like to see if I can figure a way to graph data, even if a simple bar graph for results. But first, I need to figure out the error in the following:
{local sA1, a1, s1="", i=0, imax=0
sA1 = getfield(LIST_OBS("LDL","signed","list","valuedate"),")",HRET)
imax = (if size(sA1)<=10, size(sA1), 10)
s1=""
for i=1,i<=imax,i=i+1 do
a1 = getfield(str(sA1[i]),"(","")
s1=s1+(if s1<>"",HRET,"")+a1[2]+" "+a1[1]
endfor
s1}Once this works, my plan is to
reverse the printing order (printing oldest first)
then make some kind of bar graph for results
Thoughts?
Has anyone been able to embed graph results into a letter?
Thanks.
It looks like you are trying to get the date and then the result, why not use the delimited version of LIST_OBS()? It is much more straight forward. The big problem I see is the if-then syntax
imax = (if size(sA1)<=10, size(sA1), 10)
should be more like
(if size(sA1)<=10 then imax = size(sA1) else imax = 10 endif)
Same with the other if statement in the for loop. The sA1[i] is already a string, not sure you need to remove the function but you shouldnt need it there either. You could reverse it when saving to s1 by adding s1 back to the end instead of first. I have no experience with graphs and letters, someone else will have to give you some input there
Thanks Mike.
Have the following quicktext:
{local sA1, a1, a2=0, a3="", s1="", i=0, imax=0, j=1
local HTb=numtoascii(009)
sA1 = getfield(LIST_OBS("LDL","signed","list","valuedate"),")",HRET)
if size(sA1)<=10 then imax = size(sA1) else imax = 10 endif
s1=""
for i=1,i<imax,i=i+1 do
a1 = getfield(str(sA1[i])," ","")
a1[2] = sub(a1[2],2)
a2=div(val(a1[1])+2.5,5)
a3=""
for j=1,j<=a2,j=j+1 do
a3 = a3 +"*"
if j=20 then a3 = a3 + "|" else "" endif
endfor
s1 = s1 + a1[2] + HTb + a1[1] + HTb + a3 + HRET
endfor
s1}
Which produces the following:
08/01/2014 190 *****************|************
06/01/2014 169 **************|********
04/02/2014 176 **************|*********
03/20/2014 125 **************|**
10/13/2013 99 *****************|
06/15/2013 112 *****************|**
01/13/2013 79 ****************
[Note, the tab when actually run gets things to line up nicer.]
Now, to figure out reversing the order, and also how to make 'prettier'. Hmmmm.
Any suggestions?
I use this sometimes
{fn ReverseList(var){
local temp = getfield(var,"\n","\r")
local hold = ""
for i = size(temp), i>0, i = i - 1 do
if hold <> "" then
hold = hold + hret
endif
hold = hold + temp[i]
endfor
return hold
}}
For prettiness, only thing I can think is to check the ascii characters, try numtoascii(8), its kind of a box... (I think, if I have the correct list)