Parameter order for webSdk procedures - priority-web-sdk

I need to create some reports using the websdk pertaining to orders and price quotes.
I tried following the documentation but even the example given in the developer portal is lacking a lot of crucial information.
Specifically, I need to work with these two procedures:
ESH_WWWSHOWORDER3
ESH_WWWSHOWCPROF2
I tried writing some logic arround the sample found on https://prioritysoftware.github.io/api/procedure/#Introduction
const procedure = priority.procStart(PROC_NAME,"R", () => {},customerName, function(procSuccess){
logger.info('Proc start OK, received documentOptions');
logger.info(JSON.stringify(procSuccess));
logger.info('Specifying format...');
resolve(new Promise((resolve, reject) => {
procSuccess.proc.documentOptions(1,1,2,procSuccess => {
logger.info('Received inputFields');
logger.info(JSON.stringify(procSuccess));
procSuccess.proc.inputFields(1,{ORDNUM: ordernum}, procSuccess => {
logger.info('Received url');
logger.info(JSON.stringify(procSuccess));
});
}, procError => {
reject(procError)
})
}));
}, function(procError){
logger.error('Proc start error');
logger.error(procError);
reject(procError);
});
}).catch(err => {
logger.error(err);
})
Where PROC_NAME is WWWSHOWORDER
I am trying to understand what the process is asking of me, but it's not really clear. I tried supplying some values in the order specified by the documentation but I get errors that are not very descriptive to someone who doesn't know the ins and outs of Priority.
The logs look somehting like this
Starting Procedure WWWSHOWORDER
2019-11-26T11:55:31.718Z info: Proc start OK, received documentOptions
2019-11-26T11:55:31.719Z info: {"proc":{"name":"WWWSHOWORDER"},"type":"message","message":"No such Tabula entity"}
2019-11-26T11:55:31.721Z info: Specifying format...
2019-11-26T11:55:32.124Z info: Received inputFields
2019-11-26T11:55:32.125Z info: {"proc":{"name":"WWWSHOWORDER"},"type":"message","message":"Failure to p...
Unfortunately my logs are truncated for some strange reason...
EDIT:
I switched trying to work with ESH_WWWSHOWORDER3, I am getting an inputFields parameter, and I hope what I need to do, is take the iinputFields.input.EditFields object, and populate the value field with the name of the order, I think, unfortunately this results in a 500 error from the server...
{"proc":{"title":"(אישור הזמנה עם מפרט ללקוח (פריו","name":"ESH_WWWSHOWORDER3"},"type":"inputFields","input":{"EditFields":[{"field":1,"helpstring":"","ispassword":0,"mandatory":0,"operator":0,"readonly":0,"title":"Order","type":"text","code":"Str","value":"*","value1":"","maxlength":56,"zoom":"Zoom","format":""}],"Operators":[{"name":"= ","op":0,"title":"equals"},{"name":"< ","op":1,"title":"less than"},{"name":"<=","op":2,"title":"less than or equal to"},{"name":"> ","op":3,"title":"greater than"},{"name":">=","op":4,"title":"greater than or equal to"},{"name":"<>","op":5,"title":"not equal to"},{"name":"- ","op":6,"title":"between"},{"name":"! ","op":7,"title":"ולא"},{"name":"| ","op":8,"title":"או"}],"text":"","title":"Parameter Input"}}
2019-12-02T09:07:10.129Z info: Specifying input...
2019-12-02T09:07:10.550Z error: ###Can't connect to server. HTTP Response: 500, Internal Server Error
details: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><s:Header><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><u:Timestamp u:Id="_0"><u:Created>2019-12-02T09:07:07.700Z</u:Created><u:Expires>2019-12-02T09:12:07.700Z</u:Expires></u:Timestamp></o:Security></s:Header><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode><faultstring xml:lang="he-IL">Object reference not set to an instance
of an object.</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>Object reference not set to an instance of an object.</Message><StackTrace> at WCFService.ProcEditFieldsOKMob(String session, Boolean save, Byte[] xml)
at SyncInvokeProcEditFieldsOKMob(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.NullReferenceException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>
Again, documentation does not seem to be very detailed on this topic, the EditFields object itself is not very well described...
I am also not an experienced priority user, so I am not sure where I need to navigate to check out these procedures and what else.

It seems that you are passing "R" as the second parameter, which means that you are calling for a report. Try passing "P" instead.
Also, what is customerName? according to the Web SDK I believe this should be dname: "Internal name of the company in which the procedure is run."
You can tell that WWWSHOWORDER is a Procedure and not a Report by going to System Management -> Generators -> Procedures -> Procedure Generator and querying for it. If you find it in the procedure generator - its a procedure (in this case it is a procedure which generates a report), and you should call it with a "P" parameter.
If you find the entity in Management -> Generators -> Reports-> ReportGenerator than its a plain Report and you should call it with the "R" Parameter.

Related

Snowflake Tasks causing error in timezone in queries

I am running a simple insert query inside a stored procedure with to_timeatamp_ntz("column value") along with other columns.
This works fine when I am running it with the snowflake UI and logged in with my account.
This works fine when I am calling it using python scripts from my visual studio instance.
The same stored procedure fails when it is being called by a scheduled task.
I am thinking if it has something to do with the user's timezone of 'System' vs my time zone.
Execution error in store procedure LOAD_Data(): Failed to cast variant
value "2019-11-27T13:42:03.221Z" to TIMESTAMP_NTZ At
Statement.execute, line 24 position 57
I tried to provide timezone as session parameters in task and in the stored proc but does not seem to be addressing the issue. Any ideas?
I'm guessing (since you didn't include the SQL statement that causes the error) that you are trying to bind a Date object when creating a Statement object. That won't work.
The only parameters you can bind are numbers, strings, null, and the special SfDate object that you can only get from a result set (to my knowledge). Most other parameters must be converted to string using mydate.toJSON(), JSON.stringify(myobj), etc., before binding, eg:
var stmt = snowflake.createStatement(
{ sqlText: `SELECT :1::TIMESTAMP_LTZ NOW`, binds: [(new Date).toJSON()] }
);
Date object errors can be misleading, because Date objects causing an error can be converted and displayed as strings in the error message.
I found the issue:
my Task was using a copy paste effect similar to this:
CREATE TASK TASK_LOAD_an_sp
WAREHOUSE = COMPUTE_WH
TIMEZONE = 'US/Eastern'
SCHEDULE = 'USING CRON 0/30 * * * * America/New_York'
TIMESTAMP_INPUT_FORMAT = 'YYYY-MM-DD HH24'
AS
Call LOAD_an_sp();
The Timestamp input format was causing this.

firefox addon webrequest.addListener misbehaving

I want to examine http requests in an extension for firefox. To begin figuring out how to do what I want to do I figured I'd just log everything and see what comes up:
webRequest.onResponseStarted.addListener(
(stuff) => {console.log(stuff);},
{urls: [/^.*$/]}
);
The domain is insignificant, and I know the regex works, verified in the console. When running this code I get no logging. When I take out the filter parameter I get every request:
webRequest.onResponseStarted.addListener(
(stuff) => {console.log(stuff);}
);
Cool, I'm probably doing something wrong, but I can't see what.
Another approach is to manually filter on my own:
var webRequest = Components.utils.import("resource://gre/modules/WebRequest.jsm", {});
var makeRequest = function(type) {
webRequest[type].addListener(
(stuff) => {
console.log(!stuff.url.match(/google.com.*/));
if(!stuff.url.match(/google.com.*/))
return;
console.log(type);
console.log(stuff);
}
);
}
makeRequest("onBeforeRequest");
makeRequest("onBeforeSentHeaders");
makeRequest("onSendHeaders");
makeRequest("onHeadersReceived");
makeRequest("onResponseStarted");
makeRequest("onCompleted");
With the console.log above the if, I can see the regex returning true when I want it to and the code making it past the if. When I remove the console.log above the if the if no longer gets executed.
My question is then, how do I get the filtering parameter to work or if that is indeed broken, how can I get the code past the if to be executed? Obviously, this is a fire hose, and to begin searching for a solution I will need to reduce the data.
Thanks
urls must be a string or an array of match patterns. Regular expressions are not supported.
WebRequest.jsm uses resource://gre/modules/MatchPattern.jsm. Someone might get confused with the util/match-pattern add-on sdk api, which does support regular expressions.

Datasnap & Fmx Mobile App How to send a dataset containing a blob field

I had a multi tier project in which i would collect data from a microsoft sql 2005 through a FDStoredProc with a function and the function would return a dataset to the client. When the server assigns the dataset to the result of the function and the function tries to send it to the client i get this error. Project etctec.exe raised exception class TDBXError with message 'TDBXTypes.BLOB value type cannot be accessed as TDBXTypes.Bytes value type'.
In another project i used the StoredProc of a different database with TFDStoredProc in exactly the same way and it works fine. Any ideas what would raise this error?
This is what i do in the server.
function TServerMethods1.getCategories(): TDataSet;
begin
FDStoredProc1.ParamByName('#val1').AsInteger:= 1;
FDStoredProc1.ParamByName('#val2').AsInteger:= 0;
FDStoredProc1.ParamByName('#val3').AsInteger:= 1;
FDStoredProc1.ParamByName('#val4').AsInteger:= 1;
FDStoredProc1.Open();
result:= FDStoredProc1;
end;
and the client calls it like this...
dataset:=ClientModule1.ServerMethods1Client.getCategories();
Problem comes from some fields that are of type NVARCHAR(max), anyone knows a workaround to this error without changing the field type?
I tried changing the dataset's field type to a string or something with no success. The only thing i can temporarily do is get these fields separately, put them in a stringlist or something like that and pass it to the client.
I think you should use some of similar methods below:
http://docwiki.embarcadero.com/Libraries/XE4/en/Data.DB.TDataSet.CreateBlobStream
http://docwiki.embarcadero.com/Libraries/XE4/en/Data.DB.TDataSet.GetBlobFieldData
You should define you field as a blob field and then put data in/out with the functions described in the links.
Here is also example how to copy data:
http://docwiki.embarcadero.com/Libraries/XE4/en/Data.DB.TDataSet.CreateBlobStream

EF5 need update ContainerName.FunctionImportName for accessing Stored Procedure when updating models, Any charming solution?

I'm new to entity framework, please forgive me if my question is too simple.
I'm using EF5 build my project at the moment, there is one Function Import "GetStockItem" in my project, which calls a stored procedure and returns data from SP. Every time when I "Update Model from database" from Model Diagram, the update wizard reflects the changes of database without problem, but GetStockItem stops working. The error message when I call GetStockItem is:
"The value of EntityCommand.CommandText is not valid for a StoredProcedure command. The EntityCommand.CommandText value must be of the form 'ContainerName.FunctionImportName'."
The solution, as instructed in the error message is clear, all I need is to add ContainerName. before the FunctionImportName (GetStockItem in my case) in the context.cs file.
My question is how can I avoid the from happening every time when I update models from database? It's quite annoying to do this manual thing now and then, and it's easy to forget to do this then cause users' complaint.
Hope someone can enlighten me with charming solution! Cheers!
I just ran into this using EF5/DbContext. The solution I found was to edit the T4 template ([Model].Context.tt) that generates the DbContext.
In this file, locate the instructions for generating the ExecuteFunction call. For me, it started on line 288:
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
Modify the return line so that edmFunction.Name is replaced with edmFunction.FullName and upon saving, the Function Import code will be regenerated using fully-qualified names.
I had a similar issue, I suggest not to change the context.cs file at all; only make sure the connection strings in app.config file generated by EF is the same in the calling project, especially the metadata that in the connection string is very important to be correct. If it helps, please mark this answer accepted otherwise send me the steps to reproduce this error.

World-of-Warcraft Chat Frame Filter Conflict

I have a WoW/LUA script that I am attempting to start, but it seems to conflict with the Stubby addon, which is a part of the Auctioneer addon, I believe. Here is the message I receive:
Error occured in: Stubby Count: 1 Message: Error: Original call failed
after running hooks for: ChatFrame_OnEvent Usage:
SendChatMessage(text [,type] [,language] [,targetPlayer]) Debug:
(tail call): ? [string ":OnEvent"]:1:
[string ":OnEvent"]:1
Now, the only thing that's happening in the conflicting addon is:
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", partyMsg)
The code within partyMsg is very simple as well:
local function partyMsg(msg,author,language,lineID,senderGUID)
if (store ~= msg) then
SendChatMessage(msg,"SAY",nil,nil);
end
store = msg;
end
Is this error due to two addons both trying to filter the chat frame? If so, how can this be done? It seems odd to me that Blizzard would have such a simple and yet important concept limited to one addon.
I think I see what happened here.
The reference you were using, Events/Communication, shows only the specific parameters for a particular event, regardless of context.
The context is usually an OnEvent handler.
The ChatFrame_AddMessageEventFilter function lets you use the chat frame's OnEvent handler instead of your own for chat frame events, and has well defined parameters for filters you add.
An OnEvent handler might look like:
function Foo_OnEvent(self, event, ...)
A 'ChatFrame' filter must look like this, for the first two parameters:
function Foo_ChatFrameFilter(self, event, msg, ...)
The ChatFrame filter is specific. For OnEvent however, you can make a Lua 'handler' that doesnt care about what frame it came from:
<OnEvent>
MyEventHandler(event, ...)
</OnEvent>
For the sake of completion, I will include the entire source of this addon:
local function partyMsg(someTable,msgType,msg,user,language,...)
if (store ~= msg) then
SendChatMessage(user .. " just said: ".. msg .. " using that sneaky " .. language .. " language.");
end
store = msg;
return false;
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", partyMsg)
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER",partyMsg)
There were a couple issues with the original code:
1) I was using WoWWiki to get my information, and first, I read it incorrectly. lineID and senderGUID are not the 4th and 5th arguments. Then, beyond this, WoWWiki is incorrect on this page in general. The correct arguments are listed above in the source. The first argument, a table, I am unsure of its purpose. In any case, this code now works fully.

Resources