Aladdin Magic Plugin

The migration of Adempiere modules to iDempiere

Re: Aladdin Magic Plugin

Postby red1 » Thu Sep 08, 2016 9:59 pm

Now you can also do a Callout on the fly! Thanks to an idea my host, Nakarat here in Bangkok who suggested this final killer touch. And there is more! I use a completely non plugin approach but JSR223 module already available inside the codebase. All settings are pure metadata and no code is generated thus no handling of any new plugin.xml or Callout.java! The setting in the Table-Column is automatically done for you which points to the corresponding Rule set which is also magically done. Scroll this screenshot to the bottom.

CalloutScript.png
CalloutScript.png (48.45 KiB) Viewed 6808 times

Scroll to the bottom to see the elaborate script generated for you. You can of course modify it by hand to futher refine it for example to do percentages / 100.
GeneratedRuleSet.png
GeneratedRuleSet.png (83.81 KiB) Viewed 6808 times

Follow the movie at bottom also to see how magical it is to change Callout action on demand. At the moment the operations are standard and limited but i will keep on working on it. I submitted the code so anyone can carry one the magic. The sky is the limit.
Open the New Window and you will see a new field Callout. First create more new columns to try out: Word1,Word2, Q#First, Q#Second, Q#Third.

You can first do Word1>Word2=Word1 .. it means whenever Word1 column is changed, Word2 will be set with Word1 value. You can swap any other fields for Field1=Field2

For numerical value handling
First>Third=First * Second - Third .. it means when First is changed, Third will be set to the value of First multiply by Second subtract with Third. You can also use divide sign. Just make sure to put a space before and after each operand.
You can also have an extreme case of
Field1>Field2 = Field1 or Field1>Field6=Field1 * Field2 + Field3 - Field4 / Field5


Hint: If you want to do such as this: Field1>Field3=Field2 * Field1 / 100, you have to create another field on the fly first and put a 100 default in it to refer to. I will do away with this so that you can use numericals right away later. Meanwhile you can modify the Rule by hand as suggested earlier. It is still faster with the help of Aladdin doing away with the initial legwork. Below is the changes you have to make. Note import statment for Env class and the Env.ONEHUNDRED. I tested and it works.

OneHundredPercent.png
OneHundredPercent.png (32.61 KiB) Viewed 6795 times
red1
Site Admin
 
Posts: 2759
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Aladdin Magic Plugin

Postby red1 » Fri Sep 09, 2016 6:18 am

Now i made it to handle 100 figure without any further ado and the buffer to handle up to 8 operands.

Set100.png
Set100.png (10.86 KiB) Viewed 6795 times
You can try it with any combination even + 100 / 100

Generated100.png
Generated100.png (33.8 KiB) Viewed 6795 times
Plugin jar uploaded to http://sourceforge.net/projects/red1/fi ... leCreator/. Source is at http://bitbucket.org/red1/org.my.erp
red1
Site Admin
 
Posts: 2759
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Aladdin Magic Plugin

Postby red1 » Fri Sep 09, 2016 9:56 pm

We can also use it as a fast stub maker and change the script such as this:
Code: Select all
import org.compiere.model.MBPartner;
import org.compiere.util.Env; 
if (A_Tab.getValue("C_BPartner_ID") != null) {
MBPartner partner = MBPartner.get(Env.getCtx(),(Integer)A_Tab.getValue("C_BPartner_ID"));
A_Tab.setValue("Description",partner.getValue()+" payment term:"+partner.getC_PaymentTerm());
}
result = "";

Which gives this result when you change a BP value it populates the Description:

Screen Shot 2016-09-09 at 8.54.14 PM.png
Screen Shot 2016-09-09 at 8.54.14 PM.png (17.3 KiB) Viewed 6774 times
red1
Site Admin
 
Posts: 2759
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Aladdin Magic Plugin

Postby red1 » Sat Sep 24, 2016 8:56 pm

Another suggestion from Nakarat to have a workflow creation on the fly for the Workflow Editor to continue from.
Its done as an 11 movie series to teach how to code from scratch at the same time.

WorkflowGeneration.png
WorkflowGeneration.png (31.77 KiB) Viewed 6652 times
GeneratedWF.png
GeneratedWF.png (21.92 KiB) Viewed 6652 times

Source is in http://bitbucket.org/red1/org.my.erp/
Binary plugin is in https://sourceforge.net/projects/red1/f ... leCreator/
If you have an old Aladdin plugin, you need not stop it. Just install this over. It will add the new window into the menu. Just script away!
Follow the movie series here https://www.youtube.com/playlist?list=P ... kl1kKVOybH

red1
Site Admin
 
Posts: 2759
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Previous

Return to iDempiere

Who is online

Users browsing this forum: Google [Bot] and 4 guests

cron