The @when user key function/feature.... Wish list item?
Bruce Easton
bruce at stn.com
Wed Oct 27 17:39:10 PDT 2010
I'm still thinking about what you wrote below, but what's weird is
I came across this input table earlier today that I did a while back
and noticed it used @wef* and @wbl* in a strange way. I'll post
some of it below and comment it better. (It took me a bit when I
saw it earlier to understand what it was doing.)
I have used wuk* and it really does open up a lot of possibilities
for an interface. But here, I think all I was doing was trying to
consolidate code that would use one or more little code files.
(Actually, the codes files are all just qualified sets in the same file.
They basically have a code, a description and a sequence. I use
the code files on both character-based browses from F6 and
for browser select lists. There is some variation in what is displayed
from them.)
So i have a small file called cgi_cods. I currently have twenty six
qualifiers for this file. One might hold types of vertical alignment
(top, center, bottom); another might hold values for text transformation
(lowercase, Capitalize, UPPERCASE), etc. Mainly I wanted to put them
all in the same qualifier to keep them out of view, since values for
these types of things rarely change.
I have three other files that each need to (in character base) browse
several of these code files. So what I had come up with for any file
that would need to browse these qualified data sets is as follows
(I'll try to just include the interesting parts and explain each of the
three main parts below each set of code):
50 ------- - - - - - - - - - - - - - -
@update? If: 'first initialize some constant strings
Then: declare bflds(200,*)
51 ------- - - - - - - - - - - - - - -
? If:
Then: declare origp(6,*); origp=3
52 ------- - - - - - - - - - - - - - -
? If:
Then: dim tflds(52):1
53 ------- - - - - - - - - - - - - - -
? If: '<fld#><sep><qualname>
Then: bflds="007!chainss|019|fontwgt|020|fontsty|"
54 ------- - - - - - - - - - - - - - -
? If:
Then: bflds=bflds{"023|txthali|"
55 ------- - - - - - - - - - - - - - -
- -
? If:
Then: bflds=bflds{"029|borders|"
56 ------- - - - - - - - - - - - - - -
- -
? If:
Then: screen; goto top
So above, to set up, I just set a constant string to hold all the
qualfied code files that are need for this file's input table,
where the string is made up of fld#, then a separator (usually
pipe, but "!" for variation of browse shown below) and the
name of the code file (qualifier name).
Now, for @wef* for all these qualifiers is:
88 ------- - - - - - - - - - - - - - -
@wef* ? If: 'keep track of which field you are browsing from
Then: declare wuzinf(10,*); wuzinf=tflds(@fd)
89 ------- - - - - - - - - - - - - - -
? If: 'get zero-pad version of @fd
Then: fd(3,rj0)=@fd+"0"
90 ------- - - - - - - - - - - - - - -
? If: 'find current fld# in my constant string
Then: mp(3,.0)=instr(bflds,fd)
91 ------- - - - - - - - - - - - - - -
? If: mp lt "1" 'not a browsable field
Then: end
92 ------- - - - - - - - - - - - - - -
? If: 'can be browsed
Then: show("22","26") "\kB-Browse Acceptable Values"
93 ------- - - - - - - - - - - - - - -
? If:
Then: end
And for the @wbl*, all we need is:
94 ------- - - - - - - - - - - - - - -
@wbl* ? If: mp lt "1" 'make sure it is browsable field
Then: end
95 ------- - - - - - - - - - - - - - -
? If: 'get the start pos of the qual name
Then: mx(3,.0)=mp+"4"
96 ------- - - - - - - - - - - - - - -
? If: 'get qualifier name
Then: fq(7,*)=mid(bflds,mx,"7")
97 ------- - - - - - - - - - - - - - -
? If: 'what seperator was used?
Then: ft(1,*)=mid(bflds,mx-"1","1")
98 ------- - - - - - - - - - - - - - -
? If: ft eq "!" 'want to just show desc
Then: lookup bfile = ("cgi_cods@"{fq) k=(@fd) i=A -nx
b="(brw=12,-1,4 fill=asc)[Code Description]*1 *2"
99 ------- - - - - - - - - - - - - - -
? If: ft ne "!" 'show code and desc.
Then: lookup bfile = ("cgi_cods@"{fq) k=(@fd) i=A -nx
b="(brw=12,-1,4 fill=asc)[Code]*1"
100 ------- - - - - - - - - - - - - - -
? If: not bfile 'bailed out - put back into field
Then: screen ,(@fd)
101 ------- - - - - - - - - - - - - - -
? If: 'accepted browse value
Then: tflds[@fd]=bfile(1); display; end
There is also some @wlf to check for invalid entered values, that
uses the same techniques. Of course, this only works since
the code files all have the same map. (Although the browse
shown is varied [line 98/99] depending on the separator that
was used. For some of the browses, I wanted to show just
one value - the description, and for others, I wanted to show
code and desc.) This file only looked up into five qualfiers for
codes, but some of the other files I have look into a lot more,
so my goal was to not have to write individual wef, wbl, wlf prc.
So with this kind of technique, if you have code files with near
similar maps, I think you could use this and just set up the
constant string for your particular use.
I guess it could be used against separate files instead of
qualifiers by changing the lookup lines to variably use the
filenames. For that, you might need to alot a standard
length of 40 or whatever for just the filename portion in the
constant string - in any case the length of that portion should
be consistent.
Bruce
On 10/27/10 7:12 PM, John Esak wrote:
> This is a little off this thread, but who cares.
>
> On the apps where I push an pull rows up and down with @wuk... I often use
> arrays of 2 char dummies on the screen for the different rows/files.
> Generraly, they look like:
>
>
>
> *aa *ba *ca
> *ab *bb *cb
> *ac *bc *cc
> ... ... ...
> *aj *bj *cj
>
> Everyone knows this routine and probably uses this sort of thing all the
> time.
>
> What would be so good is if there were a way to wildcard each group of two
> letter variables for the @wuk feature.
>
> It would be nice to be able to write:
>
> @wukA* if:
> then: blah blah
>
>
> @wukB*
>
>
> In fact, this might even be nice for at when leafving/entering as well, but
> not so much perhaps.
>
>
> In any case. Is this something that could be accomplished easily the way you
> now handle labels and such. I don't see why not really, but of course,
> that's why I'm asking. :-)
>
> John
> `
More information about the Filepro-list
mailing list