Variable Creation tool

craig_welton

Legendary Poster
Hi folks,

I'm playing around with a tool and wanted to see what other devs thought ...

When coding event rules you sometimes need to create a ton of variables, for example, to reference table columns. It's not so much fun to add each DD item for the variables.

My prototype allows you to enter in a TBLE or DSTR and get the list of DD items within. Then select which ones you want and it will create the variables.

See attached example. View attachment CVExample.pdf

This is the simple prototype, I was thinking to add options to control how the variable is named and scope etc. Let me know what you think.

Craig
 
Last edited:

jdelisths

Reputable Poster
Hi Craig,

I think this will be a valuable tool.

Then select which ones you want and it will create the variables.

It will be nice to have the ability to search for fields by alias and dd item name.
 

nkuebelbeck

VIP Member
there would need to be a way to control the variable names.

I like to use

sz
_[DD] ex: szF4201_DCTO

or

sz[BSFN]_[DD] ex: mnGetAuditInfo_TDAY <---this one is difficult to adhere to because of variable length constraints.
 
Last edited:

craig_welton

Legendary Poster
Thanks, yes I have that planned. Check boxes to prefix and suffix. If it truncates to much I was thinking of allowing the user to edit the formatted variable name.

Craig
 

johndanter

Legendary Poster
That's fantastic Craig :)

Does it make the whole name itself? And what would happen when there are duplicate DD items in a DSTR?
EV01 for example, does it make the cEverestEventPoint01_EV01 or do we type the extras in?

If it's automatic, only pitfal I could think of is duplicate variables
EV01 is very common. Is it smart enough to create it as different names? E1 warns you and errors when you try to do it manually
 

craig_welton

Legendary Poster
Hi Hari,

It will be nice to have the ability to search for fields by alias and dd item name.

Can you explain that a bit more? Are you thinking a way to search for items from the DD? rather than by object they are used in?

thanks
Craig
 

jdelisths

Reputable Poster
Hi Craig,

After selecting the table/dstr, produce a list of fields. Then provide the ability to search within those fields. If I type the "numb", for example, it should filter the list to show AddressNumber, UserReservedNumber for example. The search should be case insensitive.
 

craig_welton

Legendary Poster
OK, first stab at this is attached. It's just a simple Win32 executable so should not need any installer. Here are the notes...

Upon loading the tool will attempt to connect to JDE. If you already have a "session" running (activconsole, fda, rda, etc.) it will connect using that.
An icon will appear in the system tray that looks like the Variables button in the ER editor.
Right click the system tray icon to bring up the popup menu where you can quit the program.

When using an ER editor and pressing the JDE variables button, the tool window appears next to the variables dialog. In the top text box enter an object (DSTR or TBLE) and tab out. The list box below will fill with the DD items. Choose the scope and options (prefix and suffix). Select the DD items to create and press the Add DD Items button.

The program CreateVar.exe will remain running and hold a session. Close it down when done.

If you are interested, please give it a try. It's very rough, but with input from other devs, it may have a chance.

thanks
Craig
 

Attachments

  • CreateVar.zip
    11.3 KB · Views: 135

garysong

Member
This is a great tool. I am already like this tool. it will save lots of coding time.
This is enough with current feature but I just want to mention my wish here.
1. Dynamic Prefix
Sometimes I use my own prefix such as Table name or just number(0,1,2,3...) or IN/OUT(BSFN Input/Output) to group for the same usage. So maybe it would be great if we can put prefix with our own prefix.
2. Alias only
Sometimes I just use Alias only(rpt_AN8) if I don't need to see the description. Normally I use it for simple Table IO.
It works great. Thanks again
 

DSauve

Legendary Poster
This tool is nifty. Thank you, Craig.
One suggestion is to have an option to preview the variables about to be created so you can tweak the names, and then actually create them. Not a big deal, but it might be nice.

Thanks again!
 

johndanter

Legendary Poster
Agreed, I too will add F4211DocNumber_DOCO to variables, so a prefix in the name is useful.

Also, for things like when EV01 is in a DSTR, the name for EV01 is always renamed to something like cActivateFunctionality_EV01
Your add on will create EverestEventPoint01 instead right?

It might be useful to inherit the DSTR element name?

And does this cope ok with duplicated DDs in a DSTR? I couldn't find one to test :)
 
Last edited:

nkuebelbeck

VIP Member
I would rather have a find/go button than tabbing out of the box and it eventually filling the pane with variables.

A message indicating I've entered a DS or Table that doesn't exist would be handy. Maybe the description of the object I've selected too

When i click/unclick the options for Data type prefix and DD item suffix, the left hand pane should make those changes.

Kind of similar to a preview window - also being able to manually then modify would be nice as other have stated

Great tool though. You da real MVP craig!
 

Lis

Member
Me too prefers similar naming. It becomes easy to track the variables.

there would need to be a way to control the variable names.

I like to use

sz
_[DD] ex: szF4201_DCTO

or

sz[BSFN]_[DD] ex: mnGetAuditInfo_TDAY <---this one is difficult to adhere to because of variable length constraints.



Me too prefers similar naming. It becomes easy to track the variables.
 

Imrankhan

Active Member
Hi Craig,

Interesting and very useful Tool. Works really nice.
I agree with nkuebelbeck, we need find/go button to display the variables.

Thanks
Imran
 

craig_welton

Legendary Poster
OK, updated version. First, the list box is replaced with a ListView with multiple columns. DD Item, Variable, and Name. Variable column will display what the ER variable will look like. When choosing a DSTR, the variable name will be derived from the DSTR member name. You can choose how to prefix and suffix the data item name.

Prefix:

None
Data Type (sz, mn etc.)
Custom (Enables a text box to enter your own prefix)


Suffix:

None
DD Item (DOCO, AN8 etc.)
Custom (Enables a text box to enter your own suffix)

Enter the object name in the first text box. Push Get to validate the object and retrieve the DD items. If you change a Prefix/Suffix option, push Get to re-format the items.

Right click an entry to manually edit the Variable.

thanks
Craig
 

Attachments

  • CreateVar.zip
    16.6 KB · Views: 47
Top