Answers, answers, who has the answers?

Answers, answers, who has the answers?

Post by Dave Sherohm » Tue, 12 Jul 1994 02:14:13



First off, I'm still hoping to get some clues on how to set up a query to
perform the same series of actions on multiple fields in a table without having
to set up each field separately.

Now for a fresh set of questions...

1)  I've set up library code to open a multiple-selection form and get all the
selected values.  (ie, a list of contacts with a checkbox attached to each
displayed record, allowing the selection of all, some, or none of the people)
The values are tracked in a dynarray, but pdox refuses to let the library
method pass the dynarray back as a return value.  Can this be done by some
(relatively) direct means, or will the list of selections have to be passed
one-by-one?

1a)  I've noticed that Paradox only seems to track as many checkbox values as
the tableframe displays.  With DataArriveRecord, I've been able to set the
check to fit each record's actual select status as it receives focus, but not
as it comes onscreen (via moving through the list pagewise, for instance).
Any suggestions?

2)  Another library method is meant to jump from a master/detail form to a
form showing a the detail table in greater detail (say, from a Company
screen with a list of contacts to a Contact screen showing additional info
on a specific contact).  When coded specifically for each combination of
forms, it works, jumping to the desired detail record by attaching a tcursor
to a field, finding the contact, and resyncing the field.  The library version
needs to be told what field to attach itself to for this search since there are
no fields that are guarantted to be on every form; I passed this field ID to
the method as a UIObject-type variable named 'LinkField'.  All fine and well
until it hits the attach command and can't find a UIObject on the new form
named 'LinkField'.  I tried having it attach to LinkField.Value, but this
generated a syntax error (which was hardly a surprise).  How can this be
genericized?

3)  Can a tab order be established within a multirecord object without OPAL
coding?  Fields within the MROs I've tried don't respond to tab/backtab at
all...

4)  For the purposes of the DataNextSet/DataPriorSet actions, how is a 'set'
defined?  It appears to default to 10 records.  Can a different number of
records be specified?  For a table indexed on a string, can a 'set' be defined
as all records with the same first character in the index field?

5)  Say you've got a form showing two tables in a 1-1 relationship.  One table
is, of course, defined as the 'master' table.  How can a search be done on one
of the other table's fields?  What if the relationship is 1-many and the
master table is on the many side?  How about searching through a detail table?
(Do you get the impression that I'm less than satisfied with Paradox's default
DataSearch behavior?)

Th-th-th-that's all (for now) folks!


 
 
 

Answers, answers, who has the answers?

Post by Ken Ostr » Tue, 12 Jul 1994 05:34:09



Quote:>First off, I'm still hoping to get some clues on how to set up a query to
>perform the same series of actions on multiple fields in a table without having
>to set up each field separately.

Depending on what you are actually doing, this can be accomplished using
string variables for the field names you want to query on.  If you want maximum
flexibiilty use a query string

type
        ArrayOfString = Array[] string
endtype

method my_custom_query(tableName string,fieldList arrayOfString)
var
qs string
endvar

qs = "Query\n\n" + tableName + "|"

  for i from 1 to fieldList.size()
        qs = qs + fieldList[i] + "|"
  endfor

  qs = qs + "\n |"
  for i from 1to fieldList.size()
        qs = qs + "Check | "
  endfor

  qs = qs + "\n\nEndQuery"

  executeQBEString(qs,":priv:answer.db")
endmethod

This method will build a query of arbitrary size and will check all fiedls.
for more complex querying, pass in a second array which contains field values
 or whatever else you need.

Quote:>1)  I've set up library code to open a multiple-selection form and get all the
>selected values.  (ie, a list of contacts with a checkbox attached to each
>displayed record, allowing the selection of all, some, or none of the people)
>The values are tracked in a dynarray, but pdox refuses to let the library
>method pass the dynarray back as a return value.  Can this be done by some
>(relatively) direct means, or will the list of selections have to be passed
>one-by-one?

As in the above example, a method can  only pass a type if it is defined.  You
need to create a custom type at the form level and the library level and use
that as your return type.

Quote:>1a)  I've noticed that Paradox only seems to track as many checkbox values as
>the tableframe displays.  With DataArriveRecord, I've been able to set the
>check to fit each record's actual select status as it receives focus, but not
>as it comes onscreen (via moving through the list pagewise, for instance).
>Any suggestions?

use the newvalue method, or make the check box a defined field in the table with
value of true/false or something that will toggle the check box

Quote:>2)  Another library method is meant to jump from a master/detail form to a
>form showing a the detail table in greater detail (say, from a Company
>screen with a list of contacts to a Contact screen showing additional info
>on a specific contact).  When coded specifically for each combination of
>forms, it works, jumping to the desired detail record by attaching a tcursor
>to a field, finding the contact, and resyncing the field.  The library version
>needs to be told what field to attach itself to for this search since there are
>no fields that are guarantted to be on every form; I passed this field ID to
>the method as a UIObject-type variable named 'LinkField'.  All fine and well
>until it hits the attach command and can't find a UIObject on the new form
>named 'LinkField'.  I tried having it attach to LinkField.Value, but this
>generated a syntax error (which was hardly a surprise).  How can this be
>genericized?

since you are calling from the library, you have no form object to reference.
you need to create a form variable in the libray and use form.attach() to
attach to the form.  Then you can reference the field by saying formVar.uiobj

Quote:>3)  Can a tab order be established within a multirecord object without OPAL
>coding?  Fields within the MROs I've tried don't respond to tab/backtab at
>all...

sort of, but not cleanly.  you can test on the depart method and tell where to
go, or you can test on the action method for FieldForward or FieldBackward
(i think those are the constants).  There is not any way to control tab order
w/o OPAL

Quote:>4)  For the purposes of the DataNextSet/DataPriorSet actions, how is a 'set'
>defined?  It appears to default to 10 records.  Can a different number of
>records be specified?  For a table indexed on a string, can a 'set' be defined
>as all records with the same first character in the index field?

in a tableFrame, a set is the current block of records that you see in the
frame.  The next set would be the next block that fits in the frame.  if you
have 10 lines, then the set will be 10 records, 15 lines, 15 recs, etc

Quote:>5)  Say you've got a form showing two tables in a 1-1 relationship.  One table
>is, of course, defined as the 'master' table.  How can a search be done on one
>of the other table's fields?  What if the relationship is 1-many and the
>master table is on the many side?  How about searching through a detail table?
>(Do you get the impression that I'm less than satisfied with Paradox's default
>DataSearch behavior?)

You can use a tcursor in the background and resync both the master and detail
rtables.  If you do a DataSearch on a detail field, you can only search the
recods that fit in the master's set.  

Quote:>Th-th-th-that's all (for now) folks!

well put.

--

||   || ||\/|| ||=||   |||     Phone : (408) 425-7455
!!!! !! !!  !! !! !! !!   !!   Fax   : (408) 425-7516


 
 
 

Answers, answers, who has the answers?

Post by Dave Sherohm » Wed, 13 Jul 1994 01:56:10



>>1)  I've set up library code to open a multiple-selection form and get all the
<MUNCH>
>>The values are tracked in a dynarray, but pdox refuses to let the library
>>method pass the dynarray back as a return value.  Can this be done by some
<MUNCH>
>As in the above example, a method can  only pass a type if it is defined.  You
>need to create a custom type at the form level and the library level and use
>that as your return type.

Interesting that 'dynarray[] number' isn't considered a defined type...
Anyhow, I assume the custom type will need to be defined in both the form and
the library, correct?

Quote:>>1a)  I've noticed that Paradox only seems to track as many checkbox values as
>>the tableframe displays.  With DataArriveRecord, I've been able to set the
>>check to fit each record's actual select status as it receives focus, but not
>>as it comes onscreen (via moving through the list pagewise, for instance).
>use the newvalue method, or make the check box a defined field in the table with
>value of true/false or something that will toggle the check box

I don't like the idea of adding a field to the table, as the selection status
is a purely temporary datum.  I've tried using NewValue to set the checkbox to
match the selection list in my dynarray, but (even when I have ChangeValue set
the dynarray value before NewValue is called) this effectively makes it
impossible to change the value of the checkbox; clicking it has no visible
effect (the box doesn't even flash a check onscreen).

Quote:>since you are calling from the library, you have no form object to reference.
>you need to create a form variable in the libray and use form.attach() to
>attach to the form.  Then you can reference the field by saying formVar.uiobj

I've already got

method HotLink(<other values being passed in>, const LinkField uiobject)
var
  TheForm form
  Tc tcursor
endvar

TheForm.Open(NewForm) ; NewForm is string holding name of form to open
Tc.Attach(NewForm.LinkField) ; This is where it bombs
.
.
.

The error message indicates that it's looking for a field on NewForm named
"LinkField", rather than looking at LinkField to determine what field to look
for on NewForm.  Substituting "NewForm.LinkField.Value" for "NewForm.LinkField"
(predictably) resulted in a syntax error.  It occurs to me that the way to
make it work would be to change LinkField to a string and have the library
method associate the string with the name of a uiobject as it's being
referenced (since the calling form doesn't have the actual field handy to
pass the library).  Is there a method/proc to perform this conversion?

Quote:>>3)  Can a tab order be established within a multirecord object without OPAL
>>coding?  Fields within the MROs I've tried don't respond to tab/backtab at
>>all...
>sort of, but not cleanly.  you can test on the depart method and tell where to
>go, or you can test on the action method for FieldForward or FieldBackward
>(i think those are the constants).  There is not any way to control tab order
>w/o OPAL

I was hoping to avoid those...  Is there any rational reason for MROs to have a
default response to tabs of doing nothing?

Quote:>>4)  For the purposes of the DataNextSet/DataPriorSet actions, how is a 'set'
>>defined?  It appears to default to 10 records.  Can a different number of
<MUNCH>
>in a tableFrame, a set is the current block of records that you see in the
>frame.  The next set would be the next block that fits in the frame.  if you
>have 10 lines, then the set will be 10 records, 15 lines, 15 recs, etc

I should have been clearer; the case I'm asking about is a single-record form,
not a tableframe.


 
 
 

Answers, answers, who has the answers?

Post by Ken Ostr » Wed, 13 Jul 1994 06:18:58




>>>1)  I've set up library code to open a multiple-selection form and get all the
><MUNCH>
>>>The values are tracked in a dynarray, but pdox refuses to let the library
>>>method pass the dynarray back as a return value.  Can this be done by some
><MUNCH>
>>As in the above example, a method can  only pass a type if it is defined.  You
>>need to create a custom type at the form level and the library level and use
>>that as your return type.
>Interesting that 'dynarray[] number' isn't considered a defined type...
>Anyhow, I assume the custom type will need to be defined in both the form and
>the library, correct?

correct

type
        dynArrayOfAny = DynArray[] anytype
endtype

Quote:>>>1a)  I've noticed that Paradox only seems to track as many checkbox values as
>>>the tableframe displays.  With DataArriveRecord, I've been able to set the
>>>check to fit each record's actual select status as it receives focus, but not
>>>as it comes onscreen (via moving through the list pagewise, for instance).
>>use the newvalue method, or make the check box a defined field in the table with
>>value of true/false or something that will toggle the check box
>I don't like the idea of adding a field to the table, as the selection status
>is a purely temporary datum.  I've tried using NewValue to set the checkbox to
>match the selection list in my dynarray, but (even when I have ChangeValue set
>the dynarray value before NewValue is called) this effectively makes it
>impossible to change the value of the checkbox; clicking it has no visible
>effect (the box doesn't even flash a check onscreen).

The easiset way to do this is to place the field in the tabl.e  If it is a
single char A1 field, it is not taking up much space and it will not require
and OPAL code to set/change it's value.  Just make sure the table is in edit
mode any time you place the check.

Quote:>>since you are calling from the library, you have no form object to reference.
>>you need to create a form variable in the libray and use form.attach() to
>>attach to the form.  Then you can reference the field by saying formVar.uiobj
>I've already got
>method HotLink(<other values being passed in>, const LinkField uiobject)
>var
>  TheForm form
>  Tc tcursor
>endvar
>TheForm.Open(NewForm) ; NewForm is string holding name of form to open
>Tc.Attach(NewForm.LinkField) ; This is where it bombs
>.
>.
>.

<<<stuff deleted>>>

Quote:>pass the library).  Is there a method/proc to perform this conversion?

Try this instead.  Pass in the name of the object, i.e. LinkField.name to
the library.

var
  ui uobject
endvar
  ui.attach(f.(LinkFieldName))
  ui = "TestVAlue"

Quote:>I was hoping to avoid those...  Is there any rational reason for MROs to have a
>default response to tabs of doing nothing?

no, make sure you don't have other code that is interfiering. Like a global
keyPhysical method or something of the sort

Quote:>I should have been clearer; the case I'm asking about is a single-record form,
>not a tableframe.

dunno about this one.
--

||   || ||\/|| ||=||   |||     Phone : (408) 425-7455
!!!! !! !!  !! !! !! !!   !!   Fax   : (408) 425-7516

 
 
 

Answers, answers, who has the answers?

Post by Peter Hy » Fri, 15 Jul 1994 09:11:17


 > >2)  Another library method is meant to jump from a master/detail form to a
 > >form showing a the detail table in greater detail (say, from a Company
 > >screen with a list of contacts to a Contact screen showing additional info
 > >on a specific contact).  When coded specifically for each combination of
 > >forms, it works, jumping to the desired detail record by attaching a tcursor
 > >to a field, finding the contact, and resyncing the field.  The library version > >needs to be told what field to attach itself to for this search since there >  are
 > >no fields that are guarantted to be on every form; I passed this field ID to
 > >the method as a UIObject-type variable named 'LinkField'.  All fine and well
 > >until it hits the attach command and can't find a UIObject on the new form
 > >named 'LinkField'.  I tried having it attach to LinkField.Value, but this
 > >generated a syntax error (which was hardly a surprise).  How can this be
 > >genericized?
 >
 > since you are calling from the library, you have no form object to reference.
 > you need to create a form variable in the libray and use form.attach() to
 > attach to the form.  Then you can reference the field by saying formVar.uiobj

Taking it one further generalising step: if you wish to pass the NAME of the
Uiobject to use on the second form, do so in a string, then reference the
field with formVar.(fieldname) (not tested recently, but should work).

 > >3)  Can a tab order be established within a multirecord object without OPAL
 > >coding?  Fields within the MROs I've tried don't respond to tab/backtab at
 > >all...
 >
 > sort of, but not cleanly.  you can test on the depart method and tell where to
 > go, or you can test on the action method for FieldForward or FieldBackward
 > (i think those are the constants).  There is not any way to control tab order
 > w/o OPAL

Actually, if you Group fields in design mode, the tab sequence will move
through that group before moving out of it, so you can use this to control
tab order without Opal. It can be a hassle at times, but as a general
approach, it works.
Hmmm -- I haven't checked the above out on MROs -- perhaps there is
something about them and tabs which I don't know.

cheers,
peter
==============================================================================
             Peter Hyde, South Pacific Information Services Ltd
          Christchurch, New Zealand -- last time I looked outside
         <<< Please use c.d.paradox for ALL relevant messages! >>>

 
 
 

Answers, answers, who has the answers?

Post by Dave Sherohm » Thu, 14 Jul 1994 21:48:52




>>I was hoping to avoid those...  Is there any rational reason for MROs to have a
>>default response to tabs of doing nothing?

>no, make sure you don't have other code that is interfiering. Like a global
>keyPhysical method or something of the sort

I can recheck, but I really doubt it; tabbing works normally on the rest of
the form, but does nothing when a field in the MRO has focus - and this is
the case for _every_ form I've made that have MROs...


 
 
 

Answers, answers, who has the answers?

Post by Dave Sherohm » Fri, 15 Jul 1994 22:03:19



>Taking it one further generalising step: if you wish to pass the NAME of the
>Uiobject to use on the second form, do so in a string, then reference the
>field with formVar.(fieldname) (not tested recently, but should work).

That's what I was trying to do.  Thanks - it does work now that I've
parenthesized it.

Going back to another of my questions, creating a developer-defined type
DynarrayOfAny = dynarray[] anytype is _not_ sufficient to get OPAL to let
me pass a dynarray as a return value.  With Result defined as a variable of
type DynarrayOfAny, Form.Wait(Result) generates an Incompatible Type error,
while FormReturn(Result) produces a different error (but I forget just what it
is).  So much for the documentation's claim that FormReturn/Wait take
'anytype' parameters and that 'anytype' values can be dynarrays...  :p


 
 
 

Answers, answers, who has the answers?

Post by Peter Hy » Tue, 19 Jul 1994 06:35:56


 > Going back to another of my questions, creating a developer-defined type
 > DynarrayOfAny = dynarray[] anytype is _not_ sufficient to get OPAL to let
 > me pass a dynarray as a return value.

You CAN'T pass it as a RETURN value, as in   "formReturn(dynvar)".  But you
SHOULD be able to pass it to and from a library or another form using a
method which defines and accepts that type, viz:

Type Mytype=   ; whatever, I forget the syntax offhand
endType

method setInfo(var info Mytype); this method is on the TARGET form
   formfield1=info.myitem1
   etc
endmethod

method getInfo(var info Mytype); ditto
   info.item1=formfield1
   etc
endmethod

Then, in the calling form (which should also define Mytype EXACTLY the same
as the target form):

var f form info Mytype endvar

   f.open("FORM2")
   Mytype.item1=etc.
   f.setInfo(Mytype)
   f.wait()    ; Maybe check for OK return but NOT for Mytype return!
   f.getInfo(Mytype)   ; but you DO get it here!
   f.close()           ; and wrap up...

cheers,
peter

P.S. I haven't checked what the manual says or does not say or does not
manage to say or does not try to avoid saying about formReturn(), Anytype
and Dynarrays. But I *do* know the above approach works!  ;-)

==============================================================================
             Peter Hyde, South Pacific Information Services Ltd
          Christchurch, New Zealand -- last time I looked outside
         <<< Please use c.d.paradox for ALL relevant messages! >>>

 
 
 

1. Question and answer lost on a SQL query (answer from avegaart)

I have lost a few messages, so I will try to get again an answer to the
following subject that perhaps has already been given. Sorry for this. I
repoeat my question:

I am trying to do the following:
 1- From a MOVEMENTS.DBF file with details of financial operations, get the
 total of the amounts of each "account".
 2- Match the Account totals calculated against the BALANCES.DBF
(containing  Account and Balance), to get possible differences  in the
amounts.

I have saved the following answer from "avegaart":
Try:

 update "BALANCES.DBF" B inner join "MOVEMENTS.DBF" M
 on (B.account = M.account) and (B.year = M.year)
 set B.balance = sum(M.amount)
 where B.balance <> sum(M.amount)

I have tried, but I get "inner, invalid use of keyword".
I guess the update statement doesn't accept joined DBFs ?
To check for possible syntax problems I tried to leave out "inner join" but
got the same problem !
Any other suggestion ?

2. Informix ODBC VB6

3. Can an answer table append an answer table?

4. String Parsing

5. know the answer but they won't take no for an answer..

6. starter

7. RDBMS questions answered

8. Raw disk or UNIX file system?

9. Is anybody hot enough to answer?

10. Oops, expired threads so got answer just now

11. Proly simple answer!!!

12. SQL Query - EQ answers it!