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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lookups like Object Tree

Status
Not open for further replies.

hcts

Programmer
Jan 14, 2004
89
US
I am changing a lookup/selection screen and thought about modifiying it to look/work like the windows explorer/object tree. Basically I will have 2 MRO's joined together in the users priv area. MRO #1 will have the general classifications and MRO #2 will have the detail within that class. The user will be able to both select the detail class and input dollar amounts that will then go back into a journal entry screen.

I'm thinking that someone has surely done this already and has some tips or examples out there.
 
hcts,

Hm. Interesting idea. A tree view is probably not possible, but creating something that lets the user drill down to the selected record should be.

I don't (yet) have an article on my site that shows how to do this, but here's what occurs to me as I type.

Assuming your journal table contains the general and detail field values and you have a secondary index containing those values, you could:

1) Run a query to return all available general values and save that to something like :priv:genvalues.

2) Run a second query to return all available general and detail values, saving it to :priv:detvalues.

3) Create an index on detvalues that contains the general and detail.

4) Open a form with a data model along these lines:

Code:
:priv:genvalues
  +-----> :priv:detvalues
             +-----> :data:journal

This way, the user will select general values, Paradox will show matching details. The user selects one of these and then sees the related record in the main journal table.

With this in mind, consider the following code:

Code:
var
   q   Query
   tc  tCursor
   fm  Form
   t   Table
endVar

   Message( "Collecting general values..." )
   q = Query

   :data:journal | General | 
                 | Check   | 

   endQuery
   if not q.executeQBE( tc ) then
      errorShow( "Can't Run Query", "Click >> for details" )
      return
   else
      tc.instantiateView( ":priv:genvalues" )
   endIf

   Message( "Collecting detail values..." )
   q = Query

   :data:journal | General | Detail |
                 | Check   | Check  |

   endQuery
   if not q.executeQBE( tc ) then
      errorShow( "Can't Run Query", "Click >> for details" )
      return
   else
      tc.instantiateView( ":priv:detvalues" )
   endIf

   ; For best results, always formally close tCursors
   if tc.isAssigned() then
      tc.close()
   endIf

   Message( "Organizing results..." )
   t.attach( ":priv:detvalues" )
   t.setExclusive( Yes )

   index t
      primary
      on 1, 2
   endIndex
   t.unattach()

   ; open the form
   fm.open( ":forms:gdbrowse" )
   Message( "Done!" )

This is off the top of my head, so treat it as proof of concept, rather than perfectly working, but it should get you pointed in the right direction.

Hope this helps...

-- Lance

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top