• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 455
  • Last Modified:

Referencing a field from another tab in a window

I have a window with 2 tabs (tabfirst, tabsecond)

tabfirst has a couple of fields all referencing one table in the database (tableone).
tabsecond same thing, and referneces 2 tables (tableone and tabletwo)

I'm trying to make it such that when user is on tabfirst and changes the value from a drop down window (child datawindow) then 2 drop down windows from tabsecond are reset.

I don't know how to reference tabsecond while i'm in tabfirst.

typically if all 3 dddw were in one tab it would be in itemchanged() and i could just use a choose case to reset drop down datawindows for the 2 fields depending if 1st field is modified.

but i have those 2 fields in another tab. so how do i reference those fields while itemchanged() in tabfirst?

  • 2
  • 2
2 Solutions
If you have have on a window Tab control 'tab_1' with two tabs 'tabpage_1' and 'tabpage_2' you can simply reference from the dw_1 on the first tabpage_1(itemchanged event) second dw_2 on tabpage_2 as:

/*** ItemChanged Event ***/
string                    ls_data
long                       ll_row, ll_rows
datawindowchild  ldwc_yourcolumn2

/* First tabpage/DW */
MessageBox('ItemChanged', 'tab_1.tabpage_1.dw_1.row = ' + String(row) + '/data = ' + data)

/* Get child on the second tabpage/DW */
tab_1.tabpage_2.dw_2.GetChild('yourcolumn2', ldwc_yourcolumn2)
ll_rows = ldwc_yourcolumn2.RowCount()
ll_row = ldwc_yourcolumn2.Find("yourcolumn2= '" + data + "'", 1, ll_rows)

MessageBox('tab_1.tabpage_1.dw_1.ItemChanged', 'tab_1.tabpage_2.dw_2.row = ' + String(ll_row))

tab_1.tabpage_2.dw_2.SetItem(tab_1.tabpage_2.dw_2.GetRow(), 'yourcolumn2', data)

badtz7229Author Commented:
Hi, I would like it so that when the first dddw in tab1 is modified or selected then the other 2 dddw in tab2 appear blank on the window for the user and the user will only see the corresponding values when he/she clicks drop down arrow.
i have the following in tab1 itemchanged()

CHOOSE CASE GetColumnName()
      CASE "div_id"
      ll_divid = long(data)
      idwc_sub.retrieve ( ll_divid )

      tab1.tabpage3.dw_3.object.subid[row]       = 0
      tab1.tabpage3.dw_3.object.respid[row]       = 0


unfortunately, this is making those 2 dddw in tab3 appear 0 to user. when i tried
string isnull

tab1.tabpage3.dw_3.object.subid[row]       = isnull
tab1.tabpage3.dw_3.object.respid[row] = isnull

I get the following error msg:
"Type mismatch accessing external object property subid at line 10  in itemchanged event of object dw_1 of w_test"

The dataype of divid, subid, and respid are numbers.
i've done this before setting dddw to null. don't understand why this is happening ?
You are saying that fields *id are numbers but variable isnull is a STRING.

Instead of:
tab1.tabpage3.dw_3.object.subid[row]       = 0
tab1.tabpage3.dw_3.object.subid[row]       = isnull
badtz7229Author Commented:
I realized that. that was exactly my problem. so i just changed
string isnull
long isnull

and that worked.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now