IF statement in Word document is always True - ms-word

I've created a .docx document. This document contains many quick parts fields, because the document is part of a SharePoint Online Workflow, where a document is created and values inside the document are filled by the SP Workflow.
In my document, I've created an IF statement:
{ IF "[Optional_Price]" <> "€ 0,00" "*INSIDE THIS DOUBLE QUOTES I'VE INSERTED A TABLE*" "" }
[Optional_Price] is a Quick Part field. It is filled by SharePoint Workflow, as a formatted currency.
So, this could be a realistic scenario:
{ IF "€ 10,00" <> "€ 0,00" "*INSIDE THIS DOUBLE QUOTES I'VE INSERTED A TABLE*" "" }
Document is always created with table in it, even if [Optional_Price] is set as "€ 0,00", like the condition is always true.
Is the IF statement not correct?

Related

Query for searching a particular value in multiple arrays and also get the result that which array fields contains those values in mongo db

I want to search the red marked value and get name of all array fields which are containing this value. For example in this screenshot I want to search with _id and the value viz ObjectId(5e23d52622948b7c28013def) and the result should be the "followers" because it contains my required search please help me.
here is the screenshot of the documents of my social connections. I want to get the name of the array fields who are containing the marked value.
You can write your query like this
// follower
db.social.findOne({
'_id':user_id,
'social_connections.follow.followers':search_id
})
// following
db.social.findOne({
'_id':user_id,
'social_connections.follow.following':search_id
})
Here search_id is the variable id you want to search in database, and user_id is the document in which you want to search
If the result is a document, your answer is true, if its null/undefined your answer is false

Find documents with a certain field value only when another field value is a given string

I'm using this php package to make queries - https://github.com/jenssegers/laravel-mongodb
The situation is, there are two fields, user_id and post_status among others. I want to retrieve all the documents in that collection, but when post_status field value is draft, that should be retrieved only when user_id is a given string. The idea is, only logged in user finds their drafted posts among other posts.
I'm having hard time finding any solution for this problem. The app is still not in production. If I should store data is some different manner, that is an option as well.
Find documents with a certain field value only when another field value is a given string
The question your are framing is simply convert into a and query, how let's see it
when another field value is a given string
This means that you have some result sets and you need to filter out when user_id match with some string. i.e some result sets and user_id = <id>
Now consider the first part of the sentence Find documents with a certain field value
This means you are filtering the records with some values i.e "status" = "draft" and whatever result will come and want again to filter on the basis of user_id = <id>
So finally you will end-up with below query:
db.collectionName.find({"status":"draft", "user_id": "5c618615903aaa496d129d90"})
Hope this explanation will help you out or you can rephrase your question I will try to modify by ans.

Indexing and searching number field in mongodb

I have created the following collection and text index:
db.test1.insert({"name":"kumar goyal","email":'rakesh.goyal#gmail.com',"phoneNo":9742140651});
db.test1.ensureIndex({ "$**": "text" },{ name: "TextIndex" })
Partial search is working for name and email field e.g.
db.test1.runCommand("text",{search:'rakesh'});
returns the record properly but its not working on the phoneNo field.
db.test1.runCommand("text",{search:'9742'});
is not working.
I guess text index is not working on number fields. Is there anyway to make it work in mongodb?
You are inserting the telephone number as a number, but then searching for it as a string.
Perhaps you should consider inserting the telephone number as a string. You're not planning to perform any arithmetic actions on that field are you?
This way mongo will be able to perform textual searches (like the one you gave as an example) on the "numbers" but will treat them as strings.
Mongo DB full text does not support partial search. Hence it was not working, nothing to do with numbers.

How to search in a Collection with unknown structure?

I spent several hours reading through docs and forums, trying to find a solution for the following problem:
In A Mongo database, I have a collection with some unstructured data:
{"data" : "some data" , "_id" : "497ce96f395f2f052a494fd4"}
{"more_data" : "more data here" ,"recursive_data": {"some_data": "even more data here", "_id" : "497ce96f395f2f052a4323"}
{"more_unknown_data" : "string or even dictionaries" , "_id" : "497ce96f395f2f052a494fsd2"}
...
The catch is that the elements in this collections don't have a predefined structure and they can be unlimited levels.
My goal is to create a query, that searches through the collection and finds all the elements that match a regular expression( in both the keys and the values ).
For example, if I have a regex: '^even more' - It should return all the elements that have the string "even more" somewhere in the structure. In this case - that will be the second one.
Simply add an array to each object and populate it with the strings you want to be able to search on. Typically I'd lowercase those values to make case-insensitive search easy.
e.g. Tags : ["copy of string 1", "copy of string 2", ...]
You can extend this technique to index every word of every element. Sometimes I also add the field with an identifier in front of it, e.g. "genre:rock" which allows searches for values in specific fields (choose the ':' character carefully).
Add an index on this array and now you have the ability to search for any word or phrase in any document in the collection and you can search for "genre:rock" to search for that value in a specific field.
Ever if you will find a way to do this you will still face problem of slow searches, becouse there are no indexes
I had similar problem and solution was to create additional database(on same engine or any other more suitable for search) and to fill it with mongo keys and combined to one text field data. And to update it whenever mongodb data updates.
If it suitable you can also try to go this way...At least search works very fast. (I used postgresql as search backend)

How to: using OpenXML to Update Fields in Word

I am working on a prototype where I am assembling word documents using OpenXML from various different documents like other word docs.
My question is this: How do you update the fields in those word documents without having word installed.
Fields include numbered sections in each section of the assembled document, updating the table of content field and also formula fields, like =SUM(Above) that should do the work on data inserted into a table during runtime.
These documents will never be opened by end users as word documents since they must be converted to PDF on the server.
Any help would be much appreciated.