[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Using Transform to format grid turns the control to read-only

Posted on 2011-03-16
3
Medium Priority
?
1,133 Views
Last Modified: 2012-06-27
I have a grid which allows only one row as editable, all other rows are readonly with the following code in the AfterRowColChange Procedure

Thisform.grdMyGrid.SetAll([ReadOnly],Alltrim(myfield)<>"Planned POs",[column])
Thisform.grdMyGrid.SetAll([ReadOnly],Alltrim(myfield)<>"Planned POs",[row])

The above code works and only records with the value of myfield = "Planned POs" editable

Howver, trying to format the numeric cells in the grid with the following code (either in the Init or the AfterRowColchange Procedure)

FOR i = 11 TO 41
  STORE FIELD(i) TO myfield
  thisform.grdMyGrid.columns(i).ControlSource= "transform(mytable." + myfield+" ,'@z 999,999')"
NEXT i

The above formating code does in fact format the numeric fields in the grid but turns the whole grid to read only.

Can you provide code on how to format the numeric fields without locking the one row I want to edit?

Thanks
0
Comment
Question by:wheat01
[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
3 Comments
 
LVL 30

Accepted Solution

by:
Olaf Doschke earned 1000 total points
ID: 35149556
You can't use the controlsource to format the output, if the controlsource is not a field or variable, this means no way to write back changes to the controlsource and thus renders the control readonly.

Use Textbox properties Format, Inputmask. In This case set Format to 'Z' and Inputmask to '999,999'.

FOR i = 11 TO 41
  STORE FIELD(i) TO myfield
  thisform.grdMyGrid.columns(i).ControlSource= 'mytable.' + myfield
  thisform.grdMyGrid.columns(i).Text1.Format='Z'
  thisform.grdMyGrid.columns(i).Text1.Inputmask='999,999'
NEXT i

Open in new window


Bye, Olaf.
0
 
LVL 43

Expert Comment

by:pcelba
ID: 35149672
Yes, it could work. Just two notes:

1) You may assign Format and InputMask directly to the columns(i)

2) Thisform.grdMyGrid.SetAll([ReadOnly],Alltrim(myfield)<>"Planned POs",[row])
does nothing because Grid has no "row" object inside.
0
 

Author Closing Comment

by:wheat01
ID: 35150843
Thanks, worked first time.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

649 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