Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dex again - RW functions & SmartList GoTos 1

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
US
It's me again with more Dexterity questions.

I thought I was following the examples in the manuals (and sample integration) fairly well, but I just can't seem to get these to work.

I'll start with the RW functions. I decided I didn't really want to make an alternate report as I didn't need to make that many changes to it. So I decided the best way was to create a function to add the data I want via Calculated fields.

For reference sake I'm adding a field that will show if an item is on an order with a particular hold applied (Inventory Purchase Advice By Vendor report). Once I can get the calculated field working properly, I can add the specifics - which won't be a problem. The problem is getting it working, I'm receiving the error: "User defined function failed in execution." Now here are the details on the function.

Startup (Core: System)
Code:
if Trigger_RegisterFunction(function rw_TableLineString, TRIGGER_AFTER_ORIGINAL, function GetAdditionalIVData) <> SY_NOERR then
	warning "Report function trigger registration failed.";
end if;
GetAdditionalIVData (Core: System)
Code:
function returns string sData;

in integer dict_id;
in string report_name;
in string sNumber;
in integer sType;
in currency cSequenceOne;
in currency cSequenceTwo;
in integer iControl;

{If this function is not for our product then quit}
{
if dict_id <> Runtime_GetCurrentProductID() then
	abort script;
end if;
}

sData = sNumber;

As you can see very simple - meant to just return the value given to it, as a test to make sure it works and from there I would modify it.

Here is the calculated field definition:
Code:
FUNCTION_SCRIPT( rw_TableLineString 0 "Inventory Purchase Advice Report By Vendor" IV_Purchase_Advice_Vendor_TEMP.Item Number 0 0 0 0 )
It should (as far as I can see) just duplicate the Item number (according to the script), but it just produces the above error.

The other problem is with adding a GoTo to an existing SmartList. The Sales groups (Sales Transactions, and Sales Line Items) now intelligently decide which form to open SOP_Entry or SOP_Inquiry. I'm hoping to restore the choice a user has if the document is password protected for editing, thus allowing them to still view the document via SOP_Inquiry quickly and easily.

I got the menu item to show up - but clicking on it does absolutely nothing. Here are the scripts:

Startup (Core: System)
Code:
if Trigger_RegisterFocusByName(SMARTLIST, "form ASI_Explorer", TRIGGER_FOCUS_PRE, TRIGGER_AFTER_ORIGINAL, script SmartList_AddSalesInquiry) <> SY_NOERR then
	warning "Focus trigger registration for SmartList failed.";
end if;

SmartList_AddSalesInquiry (Core: System)
Code:
local integer l_error;
local string l_message;
local integer prod_id;

prod_id = Runtime_GetCurrentProductID();

{
SMARTLIST_OBJECTTYPE_SALESTRANSACTIONS or IN_Object_Type = SMARTLIST_OBJECTTYPE_SALESLINEITEMS
}

call with name "Explorer_Add_GoTo_Item" in dictionary SMARTLIST,
	DYNAMICS,
	SMARTLIST_OBJECTTYPE_SALESTRANSACTIONS,
	"Document Inquiry -bor",
	prod_id,
	resourceid(form PDP_BOR_Docs), {Unique ID for this form}
	false, {Not the default Go To item}
	l_error;
if l_error <> OKAY and l_error <> DUPLICATE then
	{set l_message to getmsg(22002);
	substitute l_message, "Explorer_Add_GoTo_Item", str(l_error);
	error l_message;}
	error "SmartList items not added.";
end if;

call with name "Explorer_Add_GoTo_Item" in dictionary SMARTLIST,
	DYNAMICS,
	SMARTLIST_OBJECTTYPE_SALESLINEITEMS,
	"Document Inquiry",
	prod_id,
	resourceid(form SOP_Inquiry), {Unique ID for this form}
	false, {Not the default Go To item}
	l_error;
if l_error <> OKAY and l_error <> DUPLICATE then
	{set l_message to getmsg(22002);
	substitute l_message, "Explorer_Add_GoTo_Item", str(l_error);
	error l_message;}
	error "SmartList items not added.";
end if;

Explorer_GoTo_Button (Core: System)
Code:
inout anonymous field IN_ListView;
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_GoTo_Dict_ID;
in integer IN_GoTo_Item;

local long selected_item;
local string LeadID;
local string CustomerID;

warning "GoTo chosen";

{Is this the Go To item added to the Customer object?}
if IN_Object_Dict_ID = DYNAMICS then
	if IN_Object_Type = SMARTLIST_OBJECTTYPE_SALESTRANSACTIONS or IN_Object_Type = SMARTLIST_OBJECTTYPE_SALESLINEITEMS then
		if IN_GoTo_Item = resourceid(form SOP_Inquiry) then
			{Try to find the first customer selected in the list}
			selected_item = ListView_SelectionGet(IN_ListView, 1);
			if selected_item <> 0 then
				warning "ST_Doc Inquiry or STL_Doc Inquiry";
			end if;
		end if;
	end if;
end if;

I can't seem to see where these 2 things are going wrong - any ideas?

Thanks.
 
Hi Borvik

I think the problem with your call to the RW function is that it is passing integer zeros to the two currency fields. It should be as shown below:

Code:
FUNCTION_SCRIPT( rw_TableLineString 0 "Inventory Purchase Advice Report By Vendor" IV_Purchase_Advice_Vendor_TEMP.Item Number 0 0.00000 0.00000 0 )

Note that your hard coded 0 for the dictionary will only work in test mode and will need the correct product ID once in runtime mode.

These RW function KBs might be useful to you:





David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer - Great Plains
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Hi Borvik

For your smartlist code I can't see anything wrong. I normally create Smartlist entries during the installation rather than everytime the window opens.

I cannot explain why the call back is not working. Have you tried getting a script log in runtime mode?

add ScriptDebugger=TRUE, ScriptDebuggerProduct=X where X is your product ID into the DEX.INI

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer - Great Plains
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Thanks Dave - that worked perfectly to fix the RW function. I'm used to .NET automatically converting types, and forgot Dex is much more strict.

I can run script debugger in runtime mode? :D I did not not know that. Will try that shortly.
 
Well, I started the script log on the SmartList window, and then selected my additional GoTo item and stopped the script. Looking at the script log - I don't see the Explorer_GoTo_Button script being called though there is mention of it as an ASI_Explorer_GoTo_Button.

Here are the last few lines:
Code:
'ASI_Explorer ASI_GoTo_List_CHG on form ASI_Explorer'
    'CurrentlyExporting() of form ASI_Explorer', 0
        'isTestMode() of form [731]', 0
    'ASI_Explorer_GoTo_Button', ?, 6, 22002
        'ASI_Sales_Transactions_GoTo_Button', "ORDST2228", 2, "STDORD", "CELLULAR0001", 22002

As a side note, I only have it adding the GoTo items at the window point because that's what the documentation showed me. I can see where only doing it at installation would be beneficial.
 
I think I have a theory as to the SmartList callback, but I'm a little hazy on it.

Before I go into it - first a question: what is the proper procedure for testing a SmartList GoTo addition like this? I am copying the development dictionary file to the GP directory (backing up the original) and just running GP. Should I be testing the SmartList GoTo, by first creating a chunk file - thus making sure it has a product id of other than 0?
 
This must be tested in runtime mode with your code in its own chunk with its own product ID. Do you have a product ID issued to you from Fargo?

It is this product ID that must be used for the creation of the Goto so that the call back will work correctly.

Copying the development dictionary is not a good idea and will not work anyway.




David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer - Great Plains
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
That would probably be why its not working then.

I don't currently have an issued product ID, I'll request one when I'm a little closer to having this completed - in the meantime I'll use one that I know we aren't using.
 
Yup, that (separating the dictionary) fixed that particular Smartlist GoTo problem - it now does do something when it is clicked.

Now to get it to do something useful.

Thanks.
 
Make sure you request a Product ID. There is no need to wait for your code to be complete.

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer - Great Plains
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top