I am seeking whether it is possible to programmatically:
You might be asking why I do not simply use itemname() but I am in a situation where I need a get one of these text values and I have no window open to pass that function a window field. Is there no other method of achieving this besides itemname()?
*This post is locked for comments
Hi Chad
I have this functionality in GP Power Tools with the exception of displaying the static values. The next build already has this feature using my own window.
The current versions can show the information by drilling down on the Field Technical Name prompt to open the Additional Field Information window.
To get the static values you need the following.
system SYS_OLFD_SET_DICT,l_DictID;
system SYS_OLFD_CONTROL_TYPE,l_dtypeid,l_fieldtype,<List Field>;
NB: You will need a hidden window to hold the List Field.
Disclaimer: Many fields dynamically build or change static values so these are only a guide.
David
Yup, lot's of maintenance involved there and you would have to check every release to make sure no new options were added to the DDLs.
Did I commit a forum faux pas? Forgive me; I did not wish to lead you by providing my own conclusions from the start. Since there are going to be DDLs loaded dynamically, I feel like the most accurate solution is building out a collection of functions, however, that is also the solution with the most up front and maintenance effort.
Clearly not under the scenario you just described, since your initial request was very specific.
The other method that can be used is to call the Dex.dic functions that do this. I used to have source code for the Dex.dic, so let me check how it's done there, i.e., Resource Information window. However, as I mentioned before, the downside to this method is, a great deal of DDLs are loaded dynamically.
Thanks for your time, Mariano.
If you were faced with needing to implement a solution for finding the string representation for a given integer value for any drop-down field across the transaction tables for all the main modules of GP (SOP_HDR_WORK, SOP_LINE_WORK, IVC_HDR_WORK, POP_Receipt, etc), would this still be your approach? I had considered this approach but was not sure if the window would flash open and give users concern. I think it would also require working out which windows to use per field and there is the potential shortcoming you pointed out.
The other approach I have considered is to build out a collection of functions for each drop-down-list (grouping some where possible, e.g. Freight Taxable and Misc Taxable).
function returns string returnValue; in integer intValue; pragma(disable warning LiteralStringUsed); case intValue in [1] returnValue = "Taxable"; in [2] returnValue = "Nontaxable"; in [3] returnValue = "Base on customers"; else returnValue = str(intValue); end case; pragma(enable warning LiteralStringUsed);
In some cases there are report writer functions which can be used, such as rw_GetWFApprovalStatusStr or rw_GetSOPTypeString.
Try this:
local integer Indx; local integer ItemCount; local string ItemText; open form xyz; close window xyz of form xyz; ItemCount = countitems(field 'Misc Taxable' of window xyz of form xyz); for Indx = 1 to ItemCount do ItemText = itemname(field 'Misc Taxable' of window xyz of form xyz, Indx); warning ItemText; end for;
close form xyz;
As you can see, I am simply opening the form and close the window(s) whose AutoOpen property is set to true. Also, even if you know the datatype is a DDL, they could be loading the field dynamically with the add item statement, which would render your suggested method ineffective.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156