Solved

PowerBuilder Datawindow protect a field

Posted on 2011-03-01
7
3,899 Views
Last Modified: 2013-12-26
Hello

I am not an expert in powerbuilder

I have a grid datawindow , 5 columns, is there away to protect a single cell from editing based on a condition ?

 I used protect but it will protect / unprotect  the whole column, even when protect used , the Enter stops working to Insert a second row (Down key event)

 I tried also in itemchanged event, (if the user  changed value the original value will override),
but didn't work also.

not necessary  "PROTECT" but any idea stops changes to this cell.

Thanks
0
Comment
Question by:m_jundi
7 Comments
 
LVL 2

Expert Comment

by:lbushby
ID: 35008160
You can use 'Protect' to achieve this but you need to use 'getrow()' as part of the expression to restrict to the row you are interested in.

e.g. entering the following as the 'protect' expression will protect the cell in row 3 only:

    if (getrow()=3,1,0)

0
 

Author Comment

by:m_jundi
ID: 35009028
Below is what I am using, please advise the correct syntax

setitem(row,"trns_price",w_new_price1)
dw_basic.object.trns_price.protect
0
 

Author Comment

by:m_jundi
ID: 35009032
Below is what I am using, please advise the correct syntax

setitem(row,"trns_price",w_new_price1)
dw_basic.object.trns_price.protect = true
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Accepted Solution

by:
lbushby earned 150 total points
ID: 35012862
You need to replace the second line with something like this:

    dw_basic.object.trns_price.protect = '0~tif(GetRow()=' + string(row) + ',1,0)'

but you really need to understand how property expressions work in Powerbuilder otherwise that's probably not going to make a lot of sense.
0
 
LVL 2

Expert Comment

by:kmanoharnaik
ID: 35014874
hi,

whats that you want to do with that perticular cell? i mean what are the conditions to make that cell protected.

Generally protect expression at design mode works for entire row or entire column.
we can control if u can specify the row no, or if its new row or if its modified..so on..
please let me know the condition.

thanks
msn
0
 
LVL 3

Assisted Solution

by:loks
loks earned 100 total points
ID: 35020827
If you use protect directly on the column name then column will be protected for all the rows even though sometimes providing the row number since it is a grid DW.

So the easiest approach is to
1. create a dummy computed control as dummycol in the DW under detail band and mark it as invisible
2. Write an expression in the protect property of the column which you need to protect it dynamically in the datawindow.
IF(dummycol ='1',0,1)

3. Set the value programatically thorugh the code into this dummycol using setitem function depending upon your need.
dw_1.SetItem(RowNumber,'dummycol', 0) for unprotected and
dw_1.SetItem(RowNumber,'dummycol', 1) for protected.

Regards,
Loks
0
 

Author Closing Comment

by:m_jundi
ID: 35025395
Thank you guys
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sybase conversion 2 63
HTML-Kit Question 5 96
Eclipse insufficient memory error 3 102
Not able to use a TRUNCATE command in 4 46
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now