How do you use a Content Provider within a content provider in a CAF? - webmethods

The document response from a webservice contains a list of objects (documents) that contains a list of objects.
eg.
Name
Surname
List of Questions(Questions)
Question
Required
QuestionID
List of Answers(Answers)
Answer
SelectedAnswer
AnswerID
I have created a content provider for the List of Questions(Questions) and populated a list, but now I would like a dropdown to be shown within that table using the questions content provider to show the possible answers for that question.
If I just create a seperate content provider for the answers, only the first set of answers are used for each of the questions.
How can I solve this issue?
I have checked this link but I am unsure how to implement

Related

How to retrieve selected answer from a drop-down question in Google Forms

I am creating a Google form where the first 3 questions are linked. With this in mind, I need therefore to be able to access the response for question 1 to use it as a parameter for question 2 and so on.
I am using a ListItem object where the object contains the names of continents in question 1, countries in that continent in question 2 and universities in that country in question 3. I've searched around and haven't found any way of accessing the answers as the user selects them.
I've thought about using sections to maybe get the information from one section to another but I haven't managed to do that either.
What I would like, in a perfect world, is the user to select an answer from question 1, depending on that answer, the choices for question 2 will change and same for question 2 with question 3.
Selected Value from DropDown in standard html form
var selectElement = document.getElementById('selectId');
var selectedValue = selectElement.options[selectElement.selectedIndex].value;
Selected Value from DropDown in Google Form
It can't be done because you can't interact with running Google Form

Way to access individual fields of pages to display on a different page - Umbraco

I have a question about how to access fields from pre-existing pages and display them in a different page.
For example I have a document type called: "People" and I create a page for several people so that the structure of my content section looks like this:
Home
page1
page2
page3
People
person1
person2
person3
The document type "People" uses contains the fields:
Name, Age, Job, Description all as textboxes.
What would you suggest is the best way of accessing the values in these fields for each page so that you loop through each person under the parent "People" and display their name/age/desc?
Using:
#{
var selection = Umbraco.TypedContent(1108).Children()
.Where(x => x.IsVisible());
}
#foreach(var item in selection){
}
I can only access the metadata for each page such as #item.Id but I cant work out how to access the fields so say #item.Name returns the persons name.
Any help will be really appreciated! Cheers.
What you get from the query above is instances of your content as IPublishedContent. This is a pretty generic interface for any type of published content, so you will not be able to directly access the specific custom properties you have defined on your document types, as normal C# properties on this object.
However - if you have ModelsBuilder enabled in your site, you should be able to do the following and get the children returned as mapped POCO classes:
var selection = Umbraco.TypedContent(1108).Children<Person>()
(or <People> .. depending on what the actual document type alias of the child items is called)
If you are not using ModelsBuilder, you would have the option of just doing this inside your foreach loop to get the values of your properties instead:
var age = item.GetPropertyValue<string>("age");
Bonus note: please rename your Name property to something else (fullname or something like that). Using Name will clash with the built-in property used for the node name :)

How to store and display with HTML m:n array(two dimensional table)

How to organize information(in MVC model) in order to represent this real example:
Survey - can have multiple questions and multiple people who will answer them
Question - only single answer - yes or no
PersonAnswer - the one that answer the question
Sample display:
My implementation so far is:
DB
Survey - Question - one to many
Question - PersonAnswer - one to many
controller code: - pseudo code
Survey.FindAllQuestions
Loop per each Question and find all answers
result is map - Survey = [Question1: AnswerList1, Question2: AnswerList2]
In the HTML looping over the map I'm able to diplay the information
Problems of my approach:
the header - people names should be calculated
sort of the lists is needed otherwise the answers will be mixed
How to manage properly if the person didn't answer a question - should I store it in the database?
Update: I'm using java and mysql.
My approach to this question would first deal with the database:
In my case this is how i would do it:
Have a table of
users->represents db users
surveyitems->with item(questions) and id(probaby autoincrement integer pkey),
surveycheks->representing the users and their checks having({
id(pkey),
checkid(foreign_key ->to surveyitems table id)
yeschecked(representing the yes)
nochecked(representi)ng the nos
})
Then in your views eg when using yii php framework
use gii tool to generate models and crud //here you can use your own
logic of saving data to db
On your survey form
1. load all surveys from table surveyitems with id and items()// display item
2. Have radio buttons with values of id(from survey items);
3.. when saving loop through all checked yes or nos and store them in surveycheks
I hope you get the idea

Wikidata API: Check whether a Wikivoyage article is linked from Wikidata

I want to programmatically check whether an English Wikivoyage article (for instance Bronzeville) is linked from the Wikidata database or not.
For instance, the Bronzeville article at English Wikivoyage is NOT linked from Wikidata (even though the item exists).
Note: Some Wikidata items have labels, but that does not imply existence or non-existence, as some items have no label, and some items with the same label refer to two different things (for instance a place and a person).
Is there a way to do this, via the Wikidata API or other?
Whether a Wikivoyage article is linked from Wikidata or not can be found via a query like the ones below:
https://en.wikivoyage.org/w/api.php?action=query&titles=Bronzeville&prop=pageprops&format=jsonfm
https://en.wikivoyage.org/w/api.php?action=query&titles=Paris&prop=pageprops&format=jsonfm
If the response contains "wikibase_item", then it means it is linked.
You can use the wbgetentities method for this. To do this, ask it for the entity that's related to the desired article on enwikivoyage. For example, for an entity where the link exists (Prague):
http://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwikivoyage&titles=Prague&format=xml&props=
You get result like this:
<entity id="q1085" type="item" />
If the link doesn't exist (Bronzeville):
http://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwikivoyage&titles=Bronzeville&format=xml&props=
The result is:
<entity site="enwikivoyage" title="Bronzeville" missing="" />
(The props= part of the query is there so that you don't get all the information about the entry, just whether it exists or not.)

How to use Form tags in jsp to fetch properties from 2 Domain Objects and display in one form

I am doing a project on Springs and Hibernate.
I have a problem which am stating below:
I have 2 entities (District and Address) and I wanted to display a form which contains properties of both entities using form tags in jsp.,for single entity I can do this with CommandName and can retrieve the form values,but if i want to include properties from 2 tables..
How can I do this???? Kindly help me...
I usually create a model object that represents all the fields on the form. Then my model object would contain a District property and an Address property. You can then use nested property paths to access the properties of the nested object.