Calculated Field - Syntax Error - ms-word

I am running a mail merge off a data set where I have fields "pledge" and "distance"
{ pledge } Yields a correct value when the merge is previewed.
Yet...
{ ={ pledge}*{distance} } Results in a syntax error.
How can I get this field to calculate correctly?

{ =pledge * distance} fixed it

Related

ParseSwift ParseObject QueryConstraint

I have two collections in a mongo DB.
Here is how a document looks in the first collection (MainCollection):
_id
:"mzWqPEDYRU"
TITLE
:"ZAZ: I want."
ownerID
:"lGutCBY52g"
accessKey
:"0kAd4TOmoK0"
_created_at
:2020-03-13T11:42:11.169+00:00
_updated_at
:2020-03-13T17:08:15.090+00:00
downloadCount
:2
And here is how it looks in the second collection (SecondCollection):
_id
:"07BOGA8bHG"
_p_unit
:"MainCollection$mzWqPEDYRU"
SENTENCE
:"I love nature peace and freedom."
Order
:5
ownerID
:"lGutCBY52g"
AUDIO
:"07067b5589d1edd1d907e96c1daf6da1_VOICE.bin"
_created_at
:2020-03-13T11:42:17.483+00:00
_updated_at
:2020-03-13T11:42:19.336+00:00
There is a parent children relationship between the first and the second collection. In the last document we can see the _p_unit field where the "mzWqPEDYRU" part points to the id of the parent in the first collection.
I have one problem from start with the following code:
func theFunction() {
do {MainCollection.query().find() {
result in
switch result {
case .success(let items):
print("items.count = \(items.count)")
for item in items {
/// ....
}
case .failure(let error):
print("Error in \(#function): \(error)")
}
}
}
}
The way this above code is written works fine and I get the number of elements in MainCollection as one would expect. But then comes a less expected behaviour, in this same code if I replace MainCollection by SecondCollection, instead of getting the number of elements in SecondCollection as I would think. I get an error like:
ParseError(code: ParseSwift.ParseError.Code.unknownError,
message: "Error decoding parse-server response:
Optional(<NSHTTPURLResponse: 0x2837211a0> { URL:}
{ Status Code: 200, Headers {} }) with error:
The data couldn’t be read because it isn’t in the correct format.
Format: Optional(\"{\\\"results\\\": .......
Can anybody point out what is causing this?
It is something like:
var SecondCollection.query(unit == documentOne).find()
The .query() method works in a key/value scheme so it should pass the key as a string and the value as the referenced type, so passing "unit" between double quotes is correct:
do {SecondCollection.query("unit" == cell).find() {
The error you're getting is because cell is a Parse.Object and it is expecting a value in that place (a property in this case).
Please try the following and see if it works for you:
do {SecondCollection.query("unit" == cell.id).find() {

How to get the nested object values in mongodb?

How do I perform the filter in collection. For example I've the collection of data like this and I want to do this rits_dbx_1>0.2,simon_dbx_1<0.5
{
"threads":{
"threads_participants":{
"participant":[
{
"#all_user_n_grams":"0",
"#reference":"rits_dbx_2",
"overall_user_participation":"0.0",
"thread":{
"#thread_id":"5e778ea6a28f9a3881c330b4",
"#text":"{'relative_to_thread_interactors': 0.0, 'relative_to_self_threads': 0}"
}
},
{
"#all_user_n_grams":"11",
"#reference":"rits_dbx_1",
"overall_user_participation":"1.0",
"thread":{
"#thread_id":"5e778ea6a28f9a3881c330b4",
"#text":"{'relative_to_thread_interactors': 1.0, 'relative_to_self_threads': 1.0}"
}
}
]
}
}
}
First I tried to get the value using the find method.
db.xml_collection.find({"threads.threads_participants.participant": {"#reference": "rits_dbx_2"}})
Also it returned nothing. Can you help with the above condition.
I understood that you you are trying to find
"#reference":"rits_dbx_2" and "overall_user_participation":["$gt":0.5]
or
"#reference":"simon_dbx_1" and "overall_user_participation":["$lt":0.2]
if so:
list(db.xml_collection.find({"$or": [{"threads.threads_participants.participant.#reference":"rits_dbx_2","threads.threads_participants.participant.overall_user_participation":{"$gt":"0.2"}},{"threads.threads_participants.participant.#reference":"simon_dbx_1","threads.threads_participants.participant.overall_user_participation":{"$lt":"0.2"}}]}))
I also recommend you to use float instead of string for overall_user_participation field to improve comparing performance and correctness.

Is it possible to filter model's subfield in Strapi's GraphQL?

With strapi GraphQL it is possible to limit the number of returned entries. However, is it also possible to limit the number of returned subentries? For example, if I have "galleries" content type with a field called "images", can I limit the number of Images returned?
This is what I tried and works:
query mainQuery {
galleries(limit: 1) {
name
image {
url
id
}
}
}
And this is what I would actually like to do but does not work. There is no error or anything but the query returns all results, not just 1:
query mainQuery {
galleries {
name
image(limit: 1) {
url
id
}
}
}
I would like to fetch all galleries but only one image in each of them. Can anybody help me solve this?

How to Validate /check the input fields value exist in back end DB or not during live change in sapui5

I have requirement where in need to create the record from SAPui5 application,
For that we have Form and enterthe all details and submit to the data base.
Now i need to validate the first field value, if that value exist in the system/DB need to populate the error, like this record already exist during livechange.
For E.g., Input fields are as follows.
Empld : 121
EmpName : tom
On Change of Empid value need to check 121 record exist in the database or not.
Following are the blogs refereed for the solution but didn't get the solution for the same.
https://blogs.sap.com/2015/10/19/how-to-sapui5-user-input-validations/
https://blogs.sap.com/2015/11/01/generic-sapui5-form-validator/
As i"m new to SAPUI5.Please help me with the coding.
Thanks in advance.
I don't know how much you are aware of Requests to the Backend but maybe you could make a Read Operation and check if there is any data returned:
First solution could be like this (with Entity key):
this.getOwnerComponent().getModel().read("/EntityPath", {
success: function(oData, response) {
if(oData.results.length === 0) {
console.log("Nothing found for this key");
}
},
error: function(oError) {
//Error Handling here
}
});
Or you could build a Filter, pass it to the read operation and check if there is any data returned:
var aFilter = new sap.m.Filter(new Filter("EmpId", sap.m.FilterOperator.EQ, "value"));
this.getOwnerComponent().getModel().read("/EntitySet", {
filters: aFilter,
success: function(oData, response) {
if(oData.results.length === 0) {
console.log("User is not available");
}
},
error: function(oError) {
//Error Handling here
}
});
However, this isn't the best way to check if there is already an entry in your database. You should do this in your Business Logic with Error Messages which get passed to the Frontend.
Hope this helps :-)

Mongodb group by on internal element

I have data in following format
{
_id:ObjectId("someid"),
"masterKey":{
"key1":"val1",
"key2":"val2",
"key3":"val3",
"key4":"val1",
"key5":"val2",
"key6":"val3",
}
}
And I am expecting result which group the duplicate values of master key.
The result should be similar to this. Or in any other format which finds duplicate values of keys with key name.
{
_id:Object("someid"),
"masterKey":{
"val1":["key1","key4"],
"val2":["key2","key5"],
"val3":["key3","key6"]
}
}