on 06-19-2015 4:06 PM
I never knew how to do this kind of logic and it really comes into play a lot. Like to learn the right way finally.
Example
LISTING OUT EACH ONE METHOD
dw_1.Object.t1.Visible=0
dw_1.Object.t2.Visible=0
dw_1.Object.t3.Visible=0
dw_1.Object.t4.Visible=0
dw_1.Object.t5.Visible=0
DESIRED METHOD(I know this does not work)
string ls_test
FOR i = 1 to 5
ls_test = "dw_1.Object.t" + String(i) + ".Visible=0"
NEXT
If you want to stay with dot notation then the following might be the maximum possible:
int colnum
dwobject dwobjects[]
...
dwobjects[]= {dw_main.object.#1, dw_main.object.#2, dw_main.object.#3, dw_main.object.#4, dw_main.object.#5}
for colnum = 1 to 5
dwobjects[colnum].visible = 0
next
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Note the statement that didn't fitted on a line in this forum:
dwobjects[]= {dw_main.object.#1, dw_main.object.#2, dw_main.object.#3, dw_main.object.#4, dw_main.object.#5}
You can also write functions for it with the dwobject array and the datawindow as arguments and different number of columns so that you have to write it only ones.
Can't remember a direct way of getting the list of columns .
int colnum
dwobject dwobjects[]
...
dwobjects[]= gfcolumns_1_to_5(dw_main)
for colnum = 1 to 5
dwobjects[colnum].visible = 0
next
gfcolumns_1_to_5 would return {dw_main.object.#1, dw_main.object.#2, dw_main.object.#3, dw_main.object.#4, dw_main.object.#5}
Ben
Hi Philip;
You can do it Brad's way ... however - there is another way:
1) create a computed SQL column (ie: cc_visible_flag)
2) Add an expression to the visible property of object that need to perform hide/show processing
=> IF ( cc_visible_flag ="Y", 1, 0)
3) Now just use a DC.SetItem (row, "cc_visible_flag", "<Y/N>") and let the DWO handle columns, labels, related computed values, CB's, lines, etc
This encapsulates the whole DWO's hide/show processing.
Food for thought.
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You'll want to use the Modify method on the datawindow:
string ls_test
FOR i = 1 to 5
ls_test = dw_1.Modify( "t" + String(i) + ".Visible=0")
NEXT
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use dw_1.Modify("t" + string (i) + "Visible='0'"
Abdallah
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.