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!

Protect column in a row dynamically

Status
Not open for further replies.

unackvi

Programmer
Aug 18, 2004
5
US
I am looping through my datawindow retrieved rows and I need to make a column for that row (only) that fulfills my condition. So I don't need to make the column Protected for all rows but only for some.
I have used Protect in the past in a datawindow using properties pane but here I had only one row.
Here is my condition: g_tax = 'F'
datawindow = dw_1
column name = amt
row_number = li_i

I have tried something like
if dw_1.object.g_tax[li_i] = 'F' then
dw_1.object.amt[li_i].Protect = 1
end if

this is not valid but then dw_1.object.amt.Protect = 1, protects the column for all rows.
Thanks in advance!!
 
Put an expression on the dw column 'amt' [something like: IF (g_tax = 'F', 0, 1) or ..1,0); I always get the protect option mixed up ]
 
Thanks for your reply. The reason I could not do it on the dw and must do in my open event dynamically is that I have another variable that gets its value from the parms sent to this window and I don't think there is a way for me to access those in the dw properties/expressions. So its like:
ix is my structure that I get passed into my window and tester is its element I am interested in:

if dw_1.object.g_tax[li_i] = 'F' and ix.tester = false then
// Protect the column amt, this row
//dw_1.object.amt[li_i].Protect = 1
end if
Any other suggestions???
Thanks!
p.s. I didn't want to complicate the question initially :)
 
Set the initial protect expression on the dw as
if(g_tax = 'F', 1, 0)

and in your open event of dw,

if ix.tester then
dw_1.object.amt.protect = 0
end if

that should do the trick
 
Oops, it should be
dw_1.object.amt.protect = '0' instead of dw_1.object.amt.protect = 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top