Interesting bug/feature
Dr. A.S.J. Botenga MD
bv.wallewijn at planet.nl
Fri Jul 25 02:25:27 PDT 2008
op 24-07-2008 21:52 schreef David Thompson op dthmpsn1 at illinois.edu:
>> I definitely agree, but please reed the solution of mr Jim Rea, witch was
>> the (only) reason for my reaction.
>
> I had read it, and his "solution" wasn't intended
> as a solution either. It was another illustration
> of a feature of the Select command.
>
> The feature under discussion was this one (taken
> from page 1706 of the Panorama Handbook.)
>
> ****************
> What if the select statement fails to select any
> records? Eeek! Panorama always requires that at
> least one record be selected at all times, it
> never allows every record in a database to be
> invisible. If none of the records in the database
> match the formula, Panorama does nothing. It¹s as
> if the select never happened. Whatever records
> were visible before remain visible after. This
> can be a problem if the following statements are
> expecting a particular subset of the database to
> be selected.
>
> Fortunately, Panorama normally handles this
> situation for you automatically so that your
> procedures will work correctly. Panorama keeps
> track of the fact that there should be no records
> selected, and it will skip any statement that
> modifies the database, including formulafill,
> sequence, propagate, unpropagate, etc. (basically
> any statement that corresponds to an item in the
> Math menu will be skipped). Panorama will
> continue skipping these statements until it comes
> to a selectall statement or another select
> statement.
>
> Panorama¹s automatic statement skipping for empty
> subsets should work fine for most applications.
> As a procedure programmer, however, you have the
> choice of overriding this statement skipping and
> programming your own solution to the empty subset
> condition. To test for an empty subset, use the
> info("empty") function.
> *****************
>
> Jim's example was meant to illustrate the use of
> info("empty") to more explicitly do what the
> Select command does implicitly. In so doing, he
> deliberately made the code longer than the
> original example code, while producing exactly
> the same results. Michael's original example was
> this.
>
> SelectA = "" ; where A has no null values
> Fill B "hello"
> Print ""
>
> The second line was intended to be
>
> Field B
> Fill "hello"
>
> The result, when none of the records has a blank
> in the A field is that the Select fails, nothing
> is done by the Fill command, but the print still
> takes place, printing whichever records happen to
> be visible. If there had been records that had
> blanks in the A field, then those records would
> have been selected, the fill would have taken
> place, and the only records printed would have
> been those that were selected.
>
> Jim's example was this.
>
> select A=""
> if info("empty")=false()
> field B
> fill "hello
> endif
> print ""
>
> This does exactly the same thing, but the code is more explicit, not shorter.
>
> Dave
At first I want to thank you for the time you gave to my suggestion. When I
find the time I will come back to it. Although basic, might it be a bit of a
semantic problem or a matter of taste? One quick remark. In the given
example, in stead of the desired hello lines, the (whole) base or selection
will be printed, so another comparison will be needed, something like
select A=""if info("empty")=false()field B fill "hello"find B="hello"if
info("found")print endif endif
whereas
field B formulafill ?(A="","hello",B)select B""if info("empty")else print
endif
only needs one and less text.
When I find more time both 'solutions' may possible be shortened a bit but
will remain different in length
> _______________________________________________
> Qna mailing list
> Qna at provue.com
> http://provue.com/mailman/listinfo/qna
More information about the Qna
mailing list