Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Sage MAS Partner
PVX_Girl
Posts: 119
Registered: 01-06-2009
0
Accepted Solution

Disable Grid Column/UDF Validation

Hi All,

 

I've been playing around with version 4.4 user defined scripting and have watched the videos....just wondering if anyone knows if is possible to disable a grid column in data entry?

 

I'd like to perform the disable in a script assigned to the validation of a particular column.  So, depending on the value entered in one column, another column may be disabled/enabled.

 

I came across the 'SY_GridHandler' object in the object reference which has methods for getting/setting grid column attributes, but I'm not sure if that is what I need.

 

Also,

 

Is it possible to validate a UDF against a MAS table?  Specifically, I'd like to add a UDF to Vendor Maintenance to hold an additional gl account - I'd like to validate against the gl account table so the lookup on this field would bring up the company's gl account list.

 

Any ideas on the above would be really helpful.

Super Contributor
connex
Posts: 795
Registered: 10-29-2008
0

Re: Disable Grid Column/UDF Validation

[ Edited ]

It's like being a kid in a candy store wondering what all the stuff tastes like. Short of buying a source license I think we are at the mercy of developers to answer your question definitively. FreezeColumn looks like a good guess. Did you try any?

 

Regarding your question about validating against a MAS table - that was just answered here. The answer is NO, but check this link and you can see the developer's response about the missing capability.  You can also see a link in this thread where you can vote for this as an import enhancement for a future release.

Dan Burleson
Sage Authorized Consultant - Ask me about advanced scripting!
e-mail me here
Sage MAS Partner
PVX_Girl
Posts: 119
Registered: 01-06-2009
0

Re: Disable Grid Column/UDF Validation

Thanks for the info connex.

 

I attempted to create GridHandler object in a script but wasn't sure if it was the correct way to go, so I didn't spend too much time with it.  What object is the 'FreezeColumn' method part of?

 

Also thank you for the link to the below thread.

Sage MAS Partner
PVX_Girl
Posts: 119
Registered: 01-06-2009
0

Re: Disable Grid Column/UDF Validation

I see now that FreezeColumn is a method of the 'Grid_Handler' - it looks like this would be used to freeze columns as you would in excel.

 

I would like to create this object in a script that validates a column, but am having trouble creating the object - I will play around with it and see what I can find.

Sage MAS Partner
PVX_Girl
Posts: 119
Registered: 01-06-2009
0

Re: Disable Grid Column/UDF Validation

I have no idea if this is possible/will work, but if anyone knows if the following is possible in a column validation script in 4.40:

 

Dim oGrid

SET oGrid = oScript.NewObject("SY_GridHandler", oSession)

 

My script throws an error on the above line - saying that the AP_Invoice_line class doesn't have a method/property 'oScript.NewObject".

 

From what I understand, the default script object (oScript) is the script object tied to the current object - in this case, 'AP_Invoice_line'.  From that point of view I can understand the creation failing - would an additional script/session object need to be created in order to create this object?

 

I'm wondering if it is even possible to create this gridhandler object in a script (I am not sure if this will help me manipulate the grid as I want to, but I was hoping to play around with its methods/properties)

 

If anyone knows any answers to the above I would really appreciate it.  Thanks.

Sage Employee
smalm
Posts: 50
Registered: 11-12-2008

Re: Disable Grid Column/UDF Validation

PVX_Girl,

 

No that's not going to work for you.  Please check out the document in this link which explains what object handles are available to you.  You may be confusing the oScript object with the Providex.Script (Business Object Interface COM) object.  These are completely different, and the oScript handle is a helper object available in the User-Defined Scripts.  There is not a NewObject() method in the oScript object, but as you will see, there is a oSession.GetObject() method to get handles to other MAS 90/200 objects.  Regardless you cannot manipulate the grid by trying to create a SY_Gridhandler object (although I admire your creativity).

 

In the attached doc you will see that while there is a method to oScript.SetUIControl(<controlName>, <action>) where <action> can be HIDE, SHOW, ENABLE, DISABLE, you will see a "Note:. Only works on controls, will not work for grid cells."  This would be an enhancement request.

 

As for how to handle your problem, you could attach scripts to the Column Pre-Validate event of the columns that you wanted to disable and do an oScript.SetError("You cannot set this field, because <your other field contains this value>").  While the cell will not be disabled it will still prevent the user from changing the value (as if it were disabled).  You would want to do this logic anyway to prevent an invalid VI job from setting the field.

 

Steve

Sage MAS Partner
PVX_Girl
Posts: 119
Registered: 01-06-2009
0

Re: Disable Grid Column/UDF Validation

Thank you for the information Steve - very helpful.

Sage MAS 90 Customer
dkendall
Posts: 8
Registered: 01-11-2010
0

Re: Order by in a grid

It has been asked a few time if the Warehouse detail on IM can be ordered by the qty in the warehouse. That way all the warehouse records created on the item that only occationally stock an item would not show above the main one.  Is there any type of sort method on the datagrid objects.  Since you can do this in the UI clicking on the column it seems like there should be a methos to just do it on the read of a record or in the customizer but I have not found it.