?
Solved

PowerBuilder Datawindow protect a field

Posted on 2011-03-01
7
Medium Priority
?
4,469 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
lbushby earned 600 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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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 column That will then direct you to their download page. From that p…
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…
Suggested Courses
Course of the Month11 days, 11 hours left to enroll

752 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