How to solve this error in XQuery. I want the data to be distinct with out duplication in XML result. I tried to add distinct-values in front of the doc in for statement, but this error was depicted.
Engine name: Saxon-PE XQuery 9.5.1.3
Severity: fatal
Description: XPTY0019: Required item type of first operand of '/' is node(); supplied value has item type xs:anyAtomicType
Start location: 23:0
URL: http://www.w3.org/TR/xpath20/#ERRXPTY0019
This is code :
for $sv1 in distinct-values(doc('tc.xml')//term/year)
let $sv2 := doc('tc.xml')//term[year= $sv1]
let $sv3 := doc('tc.xml')//student[idStudent= $sv1/idStudent](:HERE IS THE ERROR LINE:)
let $sv4 := doc('tc.xml')//program[idStudent= $sv3/idStudent]
return
<Statistics>
{$sv1 }
<Count_Student>{count($sv2)}</Count_Student>
<a50_60>{count(doc('tc.xml')/mydb//program[doc('tc.xml')/mydb//term/year =$sv1][avg>= 50 and avg < 60])}</a50_60>
</Statistics>
thank you in advance.
distinct-values() will atomize your input, this means that $sv1/idStudent won't work because $sv1 is not an element. Instead of using $sv1 on the line that give an error I think you should be using $sv2.
Related
I'm running into 2 separate issues using the Grafeas golang v1beta1 API.
What I'm trying to do
Call ListOccurrencesRequest() with a Filter to get a list of occurrences for deletion
Call DeleteOccurrence() on each occurrence from above list to delete it
Issue #1
I'm trying to set the Filter field using this GCP reference grafeas golang code as a guide.
filterStr := fmt.Sprintf(`kind=%q`, grafeas_common_proto.NoteKind_BUILD.String())
listReq := &grafeas_proto.ListOccurrencesRequest{
Parent: BuildProject,
Filter: filterStr,
PageSize: 100,
}
listOccResp, err := r.grafeasCommon.ListOccurrences(ctx, listReq)
for {
if err != nil {
log.Error("failed to iterate over occurrences", zap.NamedError("error", err))
return nil, err
}
...
But it looks like my filterStr is invalid, here's the error:
filterStr {"filterStr": "kind=\"BUILD\""}
failed to iterate over occurrences {"error": "rpc error: code = Internal desc = error while parsing filter expression: 4 errors occurred:\n\t* error parsing filter\n\t* Syntax error: token recognition error at: '=\"' (1:4)\n\t* Syntax error: token recognition error at: '\"' (1:11)\n\t* Syntax error: extraneous input 'BUILD' expecting <EOF> (1:6)\n\n"}
It looks like the \ escape character is causing trouble but I've tried it without it and get another flavor of same type of error.
Issue #2
When I call DeleteOccurrence(), I can see that the occurrence is in fact deleted from Grafeas by checking:
curl http://localhost:8080/v1beta1/projects/broker_builds/occurrences
But DeleteOccurrence() always sets the err
Code:
for _, o := range occToDelete {
log.Info("occToDelete", zap.String("occurrence", o))
_, err := r.grafeasCommon.DeleteOccurrence(ctx, &grafeas_proto.DeleteOccurrenceRequest{
Name: o,
})
if err != nil {
log.Error("failed to delete occurrence", zap.String("occurrence", o), zap.NamedError("error", err))
}
}
Error:
failed to delete occurrence {"occurrence": "projects/broker_builds/occurrences/f61a4c57-a3d3-44a9-86ee-5d58cb6c6052", "error": "rpc error: code = Internal desc = grpc: error while marshaling: proto: Marshal called with nil"}
I don't understand what the error is referring to.
This question was cross-posted on Grafeas message board.
Appreciate any help. Thanks.
Can you shed some details around the storage engine used, and the filtering implementations details?
Issue 1. filtering is not implemented in any of the storage engines in gitHub.com/grafeas/grafeas.
Issue 2. it depends what store you use, memstore/embededstore do not seem to be producing any errors similar to what you mentioned... if using postgresql store, are you trying to delete an occurrence twice?
Solution for Issue #1
I'm using grafeas-elasticsearch as the storage backend. It uses a different filter string format than the examples I had looked at in my original post.
For example, instead of = -> ==, AND -> &&, etc.
More examples can be seen here:
https://github.com/rode/grafeas-elasticsearch/blob/main/test/v1beta1/occurrence_test.go#L226
Solution for Issue #2
Known issue with grafeas
https://github.com/grafeas/grafeas/pull/456
https://github.com/grafeas/grafeas/pull/468
Unfortunately the latest tagged release of grafeas v0.1.6 does not include these fixes yet. So will need to pick them up on the next release.
Thanks to #Ovidiu Ghinet, that was a good tip
The transform is getting aborted but only if I marked the checkbox copy empty fields and also the rest of the entry of the Import set is getting stuck at pending, also I verified the transform script but no luck.
Below is the error :
Import set: ISETxxxxxxx transform stopped due to error: java.lang.NumberFormatException
java.lang.NumberFormatException
at java.math.BigDecimal.<init>(BigDecimal.java:596)
at java.math.BigDecimal.<init>(BigDecimal.java:383)
at java.math.BigDecimal.<init>(BigDecimal.java:806)
at com.glide.script.glide_elements.GlideNumber.getSafeBigDecimal(GlideNumber.java:42)
at com.glide.currency.GlideElementCurrency.coerceAmount(GlideElementCurrency.java:406)
at com.glide.currency.GlideElementCurrency.cleanAmount(GlideElementCurrency.java:389)
at com.glide.currency.GlideElementCurrency.setDisplayValue(GlideElementCurrency.java:136)
at com.glide.currency.GlideElementCurrency.setValue(GlideElementCurrency.java:89)
at com.glide.db.impex.transformer.TransformerField.copyEmptyFields(TransformerField.java:202)
at com.glide.db.impex.transformer.TransformerField.setValue(TransformerField.java:130)
at com.glide.db.impex.transformer.TransformerField.transformField(TransformerField.java:84)
at com.glide.db.impex.transformer.TransformRow.transformCurrent(TransformRow.java:100)
at com.glide.db.impex.transformer.TransformRow.transform(TransformRow.java:69)
at com.glide.db.impex.transformer.Transformer.transformBatch(Transformer.java:150)
at com.glide.db.impex.transformer.Transformer.transform(Transformer.java:76)
at com.glide.system_import_set.ImportSetTransformerImpl.transformEach(ImportSetTransformerImpl.java:239)
at com.glide.system_import_set.ImportSetTransformerImpl.transformAllMaps(ImportSetTransformerImpl.java:91)
at com.glide.system_import_set.ImportSetTransformer.transformAllMaps(ImportSetTransformer.java:64)
at com.glide.system_import_set.ImportSetTransformer.transformAllMaps(ImportSetTransformer.java:50)
at com.snc.automation.ScheduledImportSetJob.runImport(ScheduledImportSetJob.java:55)
at com.snc.automation.ScheduledImportJob.execute(ScheduledImportJob.java:45)
at com.glide.schedule.JobExecutor.execute(JobExecutor.java:83)
at com.glide.schedule.GlideScheduleWorker.executeJob(GlideScheduleWorker.java:207)
at com.glide.schedule.GlideScheduleWorker.process(GlideScheduleWorker.java:145)
at com.glide.schedule.GlideScheduleWorker.run(GlideScheduleWorker.java:62)
I'm guessing you have a field that required that is a decimal or similar.
The error java.lang.NumberFormatException indicates it's failing to convert an empty string to 0.0.
Use a source script line to convert this, something along the lines of this
answer = (function transformEntry(source) {
if (source.u_number_field.nil())
return 0.0;
})(source);
I am just trying to plant AJAX Chat for my website users. I have successfully completed the installation process with database configuration. But when I am trying to brows the domain.com/ajaxchat/index.php its returning this error given below:
XML Parsing Error: junk after document element Location: http://futurenext.esy.es/inc/chat/ Line Number 2, Column 1:
I think that the problem is in AJAXChatTemplate.php , and here the code is:
function getContent() {
if(!$this->_content) {
$this->_content = AJAXChatFileSystem::getFileContents($this->_templateFile);
}
return $this->_content;
And the error message is like:
" Non-static method AJAXChatFileSystem::getFileContents() should not be called statically, assuming $this from incompatible context in line 37"
Now please any one can help me to fix the problem. What is the problem here I can't really understand. Thanks.
I was successful using Runningvalue here:
=FormatPercent(Runningvalue(Count(Fields!id.Value),Sum,"Tablix1")/
Count(Fields!id.Value,"Tablix1"),)
But when I try the next step to only capture the status "A"'s and determine the runningvalue
=Runningvalue(Sum(iif(Fields!status.Value = "A", 1, 0),Sum,"Tablix1")
/ Count(Fields!status.Value, "Tablix1"),)
I'm getting an error: "Has an incorrect number of parameters for the function 'Runningvalue'. I've tried this a number of ways and can't get it to work.
The following expression run without error at least:
=Runningvalue(iif(Fields!status.Value = "A", 1, 0),Sum,"Tablix1")
/ Count(Fields!status.Value, "Tablix1")
There were a few issues with extra commas/parentheses and key words.
I'm having some problem about TSQLStoredProcedure. Here is the code:
storedproc->ParamByName("A")->AsInteger = adataset->FieldByName("AA")->AsInteger;
storedproc->ExecProc();
param "A" is declared integer in the form (and it's 29 in the program). Also the stored procedure has no errors. I'm sure of it. Database is Oracle 11g. By the way, as storedproc is executed an exception occurred:
...
EBcdException with message '<0000001:000000010000000:00000063612>' is not a valid BCD value
...
All was working fine with BDE but now, using dbexpress, there is this problem. I searched over the internet for some days and I did not find an answer.
I thank you in advance and beg a pardon for my English.
Francesco
Update
I searched over the web. I found something interesting at:
https://forums.codegear.com/thread.jspa?messageID=43223&tstart=0
http://www.delphigroups.info/2/8/750511.html
I decide to make some test:
SQLQuery->ParamByName("f1")->AsString = Edit1->Text;
SQLQuery->ExecSQL();
It works. Not the same for
SQLQuery->ParamByName("f1")->AsInteger = StrToInt(Edit1->Text); //ERROR DBX Error: Invalid Field Type.
SQLQuery->ParamByName("f1")->AsFloat = StrToFloat(Edit1->Text); //ERROR DBX Error: Invalid Field Type.
SQLQuery->ParamByName("f1")->AsBCD = StrToInt(Edit1->Text); //ERROR ORA-06502: PL/SQL: error: ... ORA-06512: at line 1.
SQLQuery->ParamByName("f1")->AsFMTBCD = StrToBcd(Edit2->Text); //ERROR ORA-06502: PL/SQL: error: ... ORA-06512: at line 1.
or by using TSQLStoredProc.
So now I call my pl/sql stored proc by TSQLQuery. I use "AsString" to pass values to parameters. Weird. How does dbexpress map types? Thanks in advance.