Normal Topic Retrieving a Form from another Form (Read 753 times)
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Retrieving a Form from another Form
Aug 19th, 2006 at 12:29pm
Print Post Print Post  
Baffled again (seems to be a theme here).

I have an application named WorkOrders. The Main form is Orders. There is a Total_Cost form named Cost. Cost is displayed on a Tab in Orders in a spreadsheet view with a command button "Print Summary".

What I want Print Summary to do is go from my Tab on Orders into the Cost form where I already have a working command button that retrieves the matching child records that are displayed on the Tab and then prints a report.

I'm using @SelectTreeItem to select Search Update Menu and Application Menu, but am at a loss as to what the next item should be. I'm using WriteLn to follow the steps and get a "1" returned for each of the above two items. No matter what I select on the Tree as a next item, I get a "0" returned. I'm able to do the steps manually and everything works well.

Why wouldn't I get a "1" returned if the next item in @SelectTreeItem was "WorkOrders" since it's a valid Tree item?

(Also: how do I post a .jpg file here to better help illustrate what I'm talking about?)

Thanks,
Fred
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Retrieving a Form from another Form
Reply #1 - Aug 19th, 2006 at 12:50pm
Print Post Print Post  
You need to have part of your code in Orders and part in Cost. Something like this:

From Orders:
1. Set a GlobalValue indicating that you are doing the summary:
GlobalValue("PrintSummary", "1")

2. Use @SelectTreeItem to open the Cost form in Search/Update mode.

In Cost::On Retrieve Spec Open
1. Check to see if you are in the summary process. If so, do your search and print. Clear the flag.
If @GlobalValue("PrintSummary") = "1"
{
    GlobalValue("PrintSummary", "0")
    Fill Retrieve Spec
    @SelectTreeItem to search
    Print Report
}
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: Retrieving a Form from another Form
Reply #2 - Aug 19th, 2006 at 1:06pm
Print Post Print Post  
Hi Erika,

 The issue I am having is in your step 2. I can't open the Cost form.

  I've got @SelectTreeItem("Search Update Menu!Application Menu! (and anything after this returns a "0" from WriteLn)) I would thing the next entry should be the Application name since it's the first item on the Tree, correct?

 I do have the report printing from the On Retrieve Spec Open already.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Retrieving a Form from another Form
Reply #3 - Aug 19th, 2006 at 1:13pm
Print Post Print Post  
NICEBERG wrote on Aug 19th, 2006 at 1:06pm:
Hi Erika,

  The issue I am having is in your step 2. I can't open the Cost form.

   I've got @SelectTreeItem("Search Update Menu!Application Menu! (and anything after this returns a "0" from WriteLn)) I would thing the next entry should be the Application name since it's the first item on the Tree, correct?

  I do have the report printing from the On Retrieve Spec Open already.



Ah, I see your problem. No, you don't just stack up commands with ! between them.

@SelectTreeItem is the path to a command on one tree starting from the top of that tree. Each @SelectTreeItem should be one (and only one) tree item you could click on. If you want to open the Cost form, you give the path from the top of the Application Menu.  Something like:

vTemp = @SelectTreeItem("MyAppTitle!Forms!Search/Update!CostDB!Cost")
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: Retrieving a Form from another Form
Reply #4 - Aug 19th, 2006 at 1:53pm
Print Post Print Post  
"...I get by with a little help from my friends.." (Good thing you can't hear me!)

Thank you! And thanks to the "Think Tank" that came up with WriteLn. Sure pointed out my spelligni and tpying errors. Lips Sealed
  
Back to top
 
IP Logged