ADempiere problem involving BeanShell scripting

Help is preferred to those who publish their work as Open Source and not as private branches rejecting collaboration. Such projects are not maintainable and shall be deleted.
Forum rules
This forum is personally pruned to avoid redundant posts. Related topics are grouped together. IF YOU HAVE REGISTERED, you need to send email to red1(a)red1.org with your username in the subject title to get me to activate you.

ADempiere problem involving BeanShell scripting

Postby DataSmith » Tue Feb 28, 2012 6:34 pm

Hello

I'm struggling with BeanShell scripting in ADempiere.
Outside of some return statements and some strings, nothing really works the way it should.
I'm a Java/Objective-C programmer and even if I am used to Java, BeanShell is making me to pull my hairs out.
I read the scripting tutorial on the ADempiere Wiki page, but I don't understand how to use the prefixes, the ones with the W_'s, G_'s, A_'s and the rest of the A_'s: A_WindowNo, A_Tab, A_Field, A_Value, A_OldValue, A_Ctx.
I tried this to retrieve some data, but it doesn't work:
Code: Select all
return "Validation... Color: " + A_Tab.getValue("COLORNR");

where COLORNR is a column in my database. It doesn't find the A_Tab.
Could someone explain how to call a method and how to use the prefixes, because the documentation is very poor... unfortunately.

Thank you !
DataSmith
 
Posts: 3
Joined: Mon Feb 27, 2012 9:18 pm

Re: ADempiere problem involving BeanShell scripting

Postby globalqss » Tue Feb 28, 2012 11:58 pm

Hi DataSmith, I think it can work better if you describe your need and we can guide you through the process.

I'm using beanshell extensively for callouts and validations in one project and everything is working fine - just added complexity on debugging (so, the old method of System.out.println comes to help) and some strange quirks regarding beanshell (like scope of variable definitions).

Regards,

Carlos Ruiz
globalqss
Senior
 
Posts: 590
Joined: Thu Dec 29, 2005 4:15 am
Location: Bogotá, Colombia

Re: ADempiere problem involving BeanShell scripting

Postby DataSmith » Wed Feb 29, 2012 4:42 pm

Hi !

So the problem is that I have to filter out some input fields, for example the user must enter a number between let's say 10 and 20 and I don't know how to implement the conditions for this.

Thank you !
DataSmith
 
Posts: 3
Joined: Mon Feb 27, 2012 9:18 pm

Re: ADempiere problem involving BeanShell scripting

Postby red1 » Wed Feb 29, 2012 6:28 pm

Carlos,
I will be interested to see some of your best sample 'hidden' script. :)
red1
Site Admin
 
Posts: 2326
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: ADempiere problem involving BeanShell scripting

Postby DataSmith » Wed Feb 29, 2012 7:07 pm

It would be very helpful if someone could help me resolve my problem.

Thanks !
DataSmith
 
Posts: 3
Joined: Mon Feb 27, 2012 9:18 pm

Re: ADempiere problem involving BeanShell scripting

Postby globalqss » Wed Feb 29, 2012 10:10 pm

No Redhuan, they're not hidden, they're just so full of references to custom tables and columns with spanish names that probably won't be too useful for standard Adempiere.

@DataSmith:

So the problem is that I have to filter out some input fields, for example the user must enter a number between let's say 10 and 20 and I don't know how to implement the conditions for this


You don't need script for that. You can set MinValue and MaxValue on AD_Column.

Regards,

Carlos Ruiz
globalqss
Senior
 
Posts: 590
Joined: Thu Dec 29, 2005 4:15 am
Location: Bogotá, Colombia

Re: ADempiere problem involving BeanShell scripting

Postby SETSOFTWARE » Thu Mar 01, 2012 11:55 am

Hello DataSmith,

I'm sure that Carlos' solutions will help you with your problem, if that is everything you need. But as you are doing a customization I also know you must understand how to extend ADempiere. like I told you before in the other post (http://kenai.com/projects/seterpadempiere/forums/soporte-funcional-adempiere/topics/523611-ADempiere-problem-involving-conditions- )

this link could be a good place to start. http://www.adempiere.com/index.php/Development
Javier Pérez Villamizar
SET SOFTWARE
www.setsoftware.net
SETSOFTWARE
Regular
 
Posts: 119
Joined: Wed Apr 27, 2011 11:59 am


Return to HELP ME!!!

Who is online

Users browsing this forum: No registered users and 1 guest

cron