Hello Robert!
Thank you at least I find comfort in that you understand me and that I am not alone :-)
I have marked your previous solution as the answer, since it works and is what I ended up using.

Best regards,

Magnus
 

Hello Robert!
ok I think I understand, thank you again for your time and code.

So in my first attempt I actually saved the object in the databas as a %DynamicObject but I could not get the indexing to work.
So saving as a %DynamicObject is not problem I am in control of how the information is saved.
Lets say JSON contains "firstName" how would i create the index directly without computed properties on just that property $.firstName

This below did not work and as far as I can tell it did not even understand that it was a object and just indexed the refrerence.
Index AnalyticIdx On (JSON) As %iFind.Index.Analytic(INDEXOPTION = 0, LANGUAGE = "en", LOWER = 1);
 

So I am still confused by this line below from the docs

Specify $ to index the entire JSON object. Specify $.key2 to index the JSON values at key2 and below...

ok but where should I specify $ or $.firstName, please answer if you know this.

Best regards,
Magnus

Good morning all!
Whaow thank you for your time and effort! You all gave me a great start of a new day angel


I cannot still help to wonder about the few lines found in the documentation, how to you interpret these lines below.
"Indexing a JSON Object
You can create an iFind index for text stored in a JSON object. This index specifies the starting position in the JSON structure. iFind recursively indexes all text at that level and all nested levels below it. Specify $ to index the entire JSON object. Specify $.key2 to index the JSON values at key2 and below."

Link to documentation

So using my sample json I am thinking that it means that I can choose only to index firstName by creating the index and passing an argument like $.firstName something like 

Index AnalyticIdx On (JSON) As %iFind.Index.Analytic(KEY=$.firstName, INDEXOPTION = 0, LANGUAGE = "en", LOWER = 1);

Best regards,
Magnus

Hello Timothy and thank you for your answer.
With your suggested method do I have to "manually" update the index after every insert/update to the "table" by calling
d ##class(DC.Demo.IndexJSON).Run() ?
Best regards,

Magnus

 

Hello Robert!
The JSON object can be a number of different objects with different properties.
So I was thinking that the indexing logic would be smart enough to identify for example address in {"address":"Mystreet", "city":"MyCity"} and only index that column.
Make sense?
Best regards,
Magnus

Hello again Kevin!
I cannot find a way to promote your "Comment" to an "Answer".
But if you submit it as an answer I will be happy to accept it as the answer to my question yes

Best regards,
Magnus

Hello Kevin!
That was an excellent, elegant and simple solution to my problem.
Thank you very much for your time and effort.
Best regards,
Magnus

Hello Gertjan!

I have been traveling the past week but my collegue used your solution successfully, thank you very much.

If you add your solution as a new answer to this topic I will mark it as the correct solution for this question, that way it can help others in the future.

Thanks you,

Magnus

 

 

Hello Marc!

Thank you for your answer.

Yes I have tried using properties and it is working fine but it is not what I need.

Adding a property for example called Name will results in a XML like

<urn:LogicalAddress xmlns="urn:registry:1" xmlns:hdr="urn:registry:1"><Name>Elmstreet 12</Name></urn:LogicalAddress>

The SOAP.Adressing class will result in for example with you example with the MessageID, 

<SOAP-ENV:Header><wsa:MessageID>The value here</wsa:MessageID>  </SOAP-ENV:Header>

I need the tag to be  <urn:LogicalAddress xmlns="urn:registry:1" xmlns:hdr="urn:registry:1">The value here</urn:LogicalAddress>

So that is why I need a custom SOAP header.

 

Best regards,

Magnus