Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executeQuery function in workflow returns the dictionary incorrectly #10648

Closed
hyzx86 opened this issue Nov 6, 2021 · 3 comments
Closed

executeQuery function in workflow returns the dictionary incorrectly #10648

hyzx86 opened this issue Nov 6, 2021 · 3 comments
Milestone

Comments

@hyzx86
Copy link
Contributor

hyzx86 commented Nov 6, 2021

This is my query:
image

and this is my code :

var orderList = property("zsdgData");
log("Error","过滤前的数据总数:"+ orderList.length)
var orderIds= orderList.map(x=>"'"+x['Delivery_Number']+'-'+x['Delivery_Item']+"'");

var queryParams= { ids: orderIds.join(',')};
log("Error","queryParams:"+ JSON.stringify(queryParams))
//查询数据库中已存在的项 
var result = executeQuery("SCMQueryExistsedOrderIds",queryParams) //output:{"Count":36,"Capacity":64}

log("Error","qurey result:"+ JSON.stringify(result))
var filterdData=orderList;
//排除数据库中已存在的条目
if(result!=null){
  	log("Error","qurey result is not null"+JSON.stringify(result)) // 
	var idResult= result.map(x=>x.DisplayText )
    filterdData=orderList.filter(x=> idResult.indexOf(x['Delivery_Number']+'-'+x['Delivery_Item'])==-1)
}

log("Error","过滤后的数据总数:"+ filterdData.length)

setProperty("zsdgData",filterdData)
setOutcome('Done');

log out put:

input counts :12 
queryParams:{"ids":"'145163194-10','145163285-10','145163288-10','145163304-10','145163307-10','145163315-10','145163318-10','145163323-10','145163325-10','145163327-10','145163329-10','145163331-10'"} 
result :{"Count":36,"Capacity":64} 
result is not null :{"Count":36,"Capacity":64} 
An unhandled error occurred while executing an activity. Workflow ID: '143'. Activity: '4495mt0yfpjm2vn0pc32yd5ex1', 'ScriptTask'. Putting the workflow in the faulted state. Jint.Runtime.JavaScriptException: Property 'map' of object is not a function
   at :15:2    at :15:2
@hyzx86
Copy link
Contributor Author

hyzx86 commented Nov 6, 2021

sebastienros/jint#996
@sebastienros
I added the Jint version to my startup project: 3.0.0-beta-2036
The problem is still unresolved

image

@hyzx86
Copy link
Contributor Author

hyzx86 commented Nov 7, 2021

debug jint
7LQT8Y~VL}$6CU_2I7R6O(1)

@hyzx86
Copy link
Contributor Author

hyzx86 commented Nov 8, 2021

before fix that Jint Bug sebastienros/jint#1005
we have to use the query function like this:

var result = executeQuery("QueryName",queryParams).ToArray()

hyzx86 pushed a commit to hyzx86/OrchardCore that referenced this issue Nov 8, 2021
@sebastienros sebastienros added this to the 1.x milestone Nov 11, 2021
@hyzx86 hyzx86 closed this as completed Nov 8, 2022
@sebastienros sebastienros modified the milestones: 1.x, 1.6 Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants