Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to retrieve 'o' iso blank? 1

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hi!
This is my view:
Code:
SELECT Tfinancieel.nantwform;
 FROM ;
     db_kerkhof!tfinancieel;
 WHERE  ( ?lnCont_ID ) = Tfinancieel.ncont_id;
 ORDER BY Tfinancieel.nantwform
Can I have a zero (0) as result if lnCont_ID does not has a corresponding record in table tFinancieel?

TIA
-Bart
 
If there's no matching record, you'll get no records in the view.

Tamar
 
Tamar,
Presume I have to extend the view than with a kind of dummy table which returns 0 if the original query does not return any records. Should that be a good design-manner?
KR
-Bart
 
Why? Why not just check whether there are any records in the view, using either RECCOUNT() or _TALLY?

Tamar
 
I agree with Tamar.

Why not do something like:
Code:
SELECT Tfinancieel.nantwform;
  FROM db_kerkhof!tfinancieel;
  WHERE  ( ?lnCont_ID ) = Tfinancieel.ncont_id;
  ORDER BY Tfinancieel.nantwform

IF RECCOUNT() > 0
   * --- Records Returned By SQL Query ---
   <Do Whatever>
ELSE
   * --- No Records Returned By SQL Query ---
   <Do Something Else>
ENDIF

Good Luck,
JRB-Bldr
 
Hi!

I am using the view as controlsource for a listbox.
My users want to see at least a '0'(zero) in the listbox i.s.o. a blank list if no records are in the view.
In my afterskip-method I do requery the view.
So I should use _tally than to force to show zero in listbox than?

TIA
-Bart
 
Hi Bart,

No, you do

Code:
if _tally=0
   insert into View (nantwform) Values (0)
endif

Bye, Olaf.
 
Hi Olaf,

Thanks!
Never searched this direction which perfectly covers my needs here!
Star worth!!

KR
-Bart
 
I wouldn't add a record to the view because I'd be concerned about accidentally writing it back to the real data.

Instead of using the view as the RecordSource, set up an array RecordSource and use a query in the Requery method to move the data from the view to the array.

Tamar
 
Tamar,
Can understand your concern but I use to have clear naming-conventions i.e.:
v_viewname = not updatable view
vp_viewname = parametrized view
vu_viewname = updatable view
vpu_viewname = updatable parametrized view
So in this case for me not a real risc.
KR
-Bart
 
Hi Bart,

you never gave any view name. Therefore we couldn't even guess what your view naming convention would mean.

I simply made the assumption this view is not for data entry/modification, as it's a single field view without any keyfield, it's very unlikely that the view is updatable.

It could have been a simplification of the real view, though.

Bye, Olaf.
 
Olaf,
You got it exact as you write it down.
And, appologize for not giving the view's name before.
I simply didnot thought about it as I copied a strophe from the view-manager.
KR
-Bart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top