How to get Nested Dictionary Item in Umbraco? - umbraco

I using Umbraco 7.4.3.
I created few dictionary items (rot item with few children items), like below:
HomePage
Intro
Body
When I try to get dictionary value for sub-item I getting empty string, however for root item I get correct result.
For example,
this call works - returns value according to current language:
#Umbraco.GetDictionaryValue("HomePage")
but this call doesn't work - returns empty string:
#Umbraco.GetDictionaryValue("HomePage.Intro")
Please help!

Make sure the child dictionary item has the full key specified: "HomePage.Intro"
Your tree should look like this:
HomePage
- HomePage.Intro
An example of the dictionary tree I'm currently using:

Related

Adding Items from Lists to Dictionaries in Apple Shortcuts

I have this Shortcut which queries a Notion database, then fetches the IDs and titles of pages from the database and turns them into key : value pairs.
I want to add those key : value pairs to the dictionary shown at the top of the screenshot. The problem is, even though I can see that I'm adding to the dictionary inside the Repeat With Each Item loop -
When I check the contents of my Categories dictionary at the end of the Shortcut, those entries haven't been saved.
I have seen this answer, which appears to solve the same problem. But when I implement it and then check the contents of the variable inside the loop, nothing is even being set here.
I'd be very grateful for any pointers here.
I figured out the problem - I needed to set the dictionary as a variable outside the loop -
And then I can update the dictionary inside the loop -
I don't know why that works but it does ¯\(ツ)/¯

How to pass data to Mat-Menu from parent button?

I'm building a component that displays menus by the following array
names = [{name:'John'}, {name:'Bill'}, {name:'Dan'}];
So i by iterating the array - will get 3 menus - like here :
What i need to be able to do is to display for each menu it's "name" , so instead of "My Name" - it should displays each of the names in the array (John, Bill, Dan)....
I know i could be done by using the [matMenuTriggerData] directive - but i can't understand how to implement it....
Example

How to retrieve the value of an auto generated key object inside another object in Firebase IOS?

So this is my database structure which has "plastic" as a main object and when user input something new into the database it will generated a new item separately and sequentially with unique key as shown in the image. My problem is I want to retrieve all the value inside those child object individually such as name and price. However, what I can do now is to retrieve everything inside "plastic" object and the result is all they key with key value pair inside which is something I don't expect to get.
Here is my database structure
What I want to get is all those name and price which is located inside the autogenerated key. I have tried printing the "plastic" object and the result is just not what I expected to get by showing all the key and the value both at the same time.
Here is the result I get in Xcode

How to remove an item from JSON array in Swift (using SwiftyJSON)

Pretty simple and straightforward question.
I have a jsonArray, and i want to delete an item by index. How do I do that?
I tried using the solution from here:
https://github.com/SwiftyJSON/SwiftyJSON/issues/439
Like this:
jsonArray[row]["Likers"].array!.dictionaryObject?.removeValueForKey(index)
But I got this error:
value of type json has no member dictionaryObject
Finally I found the answer to remove an element in JSON (array type) created by SwiftyJSON:
dataObj.arrayObject?.removeAtIndex(m)
By the way, to remove an element when JSON returned by SwiftyJSON in a dictionary type:
jsonObj.dictionaryObject?.removeValueForKey(keyValue)
I'm getting this answer form THIS
you just use
yourJsonArry.removeAtIndex(2)
Hear you just pass the index that you want to remove items

Get the display value from a DropDown

I'm trying to access the values in the FormCollection inside of an action. I can get the value field by doing:
var value = formCollection["MyDropDownList"];
But I can't seem to find a way to get the display value. Am I missing something obvious? A cast perhaps?
Getting text from an HTML drop down selection list using JavaScript code
To get the text from each option is slightly trickier. We use the selectedIndex property of the selection list to capture the selected option and then pass this value to the options[].text property.
Here is the code
var w = document.myform.mylist.selectedIndex;
var selected_text = document.myform.mylist.options[w].text;
I don't think there's a way to get the display column from the formcollection. Basically, the formcollection is an easy way to interrogate the Request object (Request.Form, Request.QueryString, etc.) and the only thing that goes into that are values from input fields.
If you really need to get the display text, you would have to get it from whatever collection you bound the list with and access it via the key (your selected value from the formcollection). For example, if it's a dictionary collection that you bound to the list, use that same dictionary to lookup the value based on the key.
I would need to know more information as to how you're binding the dropdown to help you further.
That's the normal behaviour. When a form is posted, only the name-value collection generated from the form fields are sent to the server. And of course the inner text of the option tag doesn't belong to that collection.
you do it ok, dropdown list sended shows value of selected item not displayed text of selected item...if you want(from some reason, because I am asumming you are filling that dropdown on model right? :)) to see send a display text also, maybe you can put it in hidden field with javascript on every change of selection in dropdown...
cheers

Resources