Establish relationship between Picklist in Salesforce - salesforce

My problem is something similar to the question already asked in the forum https://salesforce.stackexchange.com/questions/16867/picklist-dependent-on-2-controlling-picklist. However, I am looking for more concrete solution. My case in brief, I want to devise a picklist A which is the primary picklist. For some values of A among different values being present in B, some are applicable(For example state city relationship). Based on the values of A & B applicable values of C will be displayed. Please provide me with a detailed solution of how it may be achieved.
Tried searching google and looking into dependant and controlling picklist in Salesforce.
NA
NA

Related

Autofill record when option from dropdown is selected

I'm creating an Access DB tool to centralize some administration work for two teams. I work for a company that creates examens.
In my database I have several tables. But the two relevant tables are one where I list all the exams and one where I list all the subjects.
Table exams
Table subjects (relevant columns in this story: subject and type)
In the table of subjects there are three colums. One for ID, one for the subject itself and one for the kind of subject. (Oral exam, written exam...)
Example data
1 - Oral English - Oral
2 - Written French - Written
3 - Computer Science - Pratical
4 - History - Written
So, in the table of exams, I was able to link it succesfully with the table of subjects. But I'm able to create mismatches.
So, I can say that oral english is a written exam.
Is there a way to prevent this? So, that Access gives an error when I put something in the exam table that doesn't match the subject table? Or can I somehow autofill the type column when I enter the subject in the exam table?
I hope I explained the issue clearly enough, if there are any questions, feel free to ask me. I'm using Access 2013 in this project
After reading the question 3 times, I figured what you wanted is to autofill a control (i.e. textbox) based on the pick of a combobox.
To make it so, your combo's property limit to list should be set to yes.
To make it impossible for users to type wrong types of exam, like selecting English and writing Practice Exam, the textbox containing ExamType, locked's property must be set to true.
Then on the Combobox (Dropdown) Afterupdate event, you must insert the code below to search automagically for the Type of exam:
textboxExamType.value = Dlookup("[KindofSubject]","TableSubjects","[Subject]='" & comboboxExam.Text & "'")
You will have to adjust the names of the controls and fields, because you did not provide them. Next time first read How to Ask

Database design for classified ad item specification

I'm working on a classified ads site with 12 categories. E.g. category vehicles has items cars, bikes, Commercial Vehicles and spare parts. The following is a flow diagram for posting an ad:
I need to show the specification in the Form Filled section of the above image to the users in dropdown lists in the form when they are posting an advertisement. The car specification will be its color,engine,fuel type.
The ERD is below :
How should this issue be tackled, what are the best practices and is the current design going along the right lines?
On the whole this looks ok. Here are some observations:
likes.iker_id should point at users.id? Just trying to understand your model to start.
I would probably change the pics table to be one pic per row and then add an ordinal for ordering.
One question here is how you intend to look at your graph model. As it is, you might have a graph that could be traversed easily to a depth, a couple deep. I assume you are doing this to recommend ads. If so, I think this is sufficient. If not it would be good to further discuss which rdbms you are targetting.
Hope this helps:
In a simplified case, you will need some extra tables.
So, you are trying to be able to have different specifications for different items in your categories? Or, in other words, it is like having different attributes for different types of products in an e-commerce website.
If that the problem you are tackling, then you should look into the Entity–Attribute–Value (EAV) model that is how the problem is solved. By the way, one of the most popular open source e-commerce engines uses it as well.
i agree look at EAV models...
for some other tables, you have many normalization issues - for example:
you should have a separate address table (not part of the ad)
you should have a picture table (and link those to the ads with another table)
you should have a person table - and link that to the ad as 'owner'
the idea of 'favorite' should also be in this person->ad relationship table as a role or type column

How to autosuggest for entries that may already exist using title in the add entry form using typeahead and CakePHP?

If you notice when typing the title of a question in StackOverflow, SO will attempt to suggest questions that already contain the answer. Right below the title itself.
For e.g.
I am trying to do something similar in CakePHP 3.1 for a model called Companies.
For Companies,
I want to auto-suggest possible existing companies based on the name field right below the name as well.
See the form below
If you notice, there are 4 words supplied. Wuhan, Electric, Co, Ltd
I want to fetch a list of possible existing companies which have names containing at least one of the words Wuhan, Electric.
In terms of MySQL query, it will be something like
SELECT id, name from companies where name
WHERE MATCH (name)
AGAINST ('Wuhan Eletric Co Ltd' IN NATURAL LANGUAGE MODE);
In my mind, I need the following:
a way to implement the autocomplete
an endpoint for the ajax to collect a list of possible companies
For 1, my googling led me to find typeahead.js http://twitter.github.io/typeahead.js/examples/
My questions for typeahead.js are:
a) can I separate the display of the fetched results separate from the text input of the name field?
b) which type of typeahead should I use? Options include remote dataset, custom templates, etc.
c) should I even use typeahead.js? Should I use something else instead?
For 2, my questions are
a) since I am using crud from https://github.com/FriendsOfCake/crud, is there a standard action I can use?
b) or I need to change the conditions?
What I am using:
CakePHP 3.1.1
Crud 4.2.0
Why do I need this?
I want to prevent users accidentally duplicate companies while at the same time, I cannot set it such that the name of the company is a unique field in the database.

Database design for like/love relations

I know this might have been asked quite a few times, however I can not find any suitable solution for my problem.
I am implementing database where I have users and articles.
Now the article can be either liked or loved by any of the user.
And here comes the problem, I have to return json that contains list of all articles extended by two fields, liked and loved, because queries are gonna be connected to users.
So liked and loved might be true or false.
I thought about creating two different tables Liked & Loved where I would keep article_id - user_id and if that record exists that means user liked/loved particular article. However I am not quite sure if thats the correct way, nor I have any idea how would I build such query.
If it is important I am using postgresql together with ormlite.
Thanks for any ideas.
If I have understand your question you are basically describing an M-N relationship. A user likes/loves N articles and an article is liked/loved by M users. Such relationships are implemented via a third table that stores the association of users and articles.
You could create a table UserPreferences that links user_id and article_id and has extra columns to indicate if he liked/loved the article.
I can't tell you more about the schema since I don't know if you have other degrees about the preferences (hated, indifferent, confused etc)

Efficient way to store a dynamic questionnaire?

In reference to this question, I am facing almost the same scenario except that in my case, the questions are probably static (it's subject to change from time to time, and I still think it's not a good idea adding columns for each question, but even I decided to add, how should the answers be specified/retrieved from), but the answers are in different types, for examples the answer could be yes/no, list-items, free text, list-items OR free text (Other, Please specify), multiple-selectable-list items etc.
What would be an efficient way to implement this?
Shimmy, I have written a four-part article that addresses this issue - see Creating a Dynamic, Data-Drive User Interface. The article looks at how to let a user define what data to store about clients, so it's not an exact examination of your question, but it's pretty close. Namely, my article shows how to let an end user define the type of data to store, which is along the lines of what you want.
The following ER diagram gives the gist of the data model:
Here, DynamicAttributesForClients is the table that indicates what user-created attributes a user wants to track for his clients. In short, each attribute has a DataTypeId value, which indicates whether it's a Boolean attribute, a Text attribute, a Numeric attribute, and so on. In your case, this table would store the questions of the survey.
The DynamicValuesForClients table holds the values stored for a particular client for a particular attribute. In your case, this table would store the answers to the questions of the survey. The actual value is stored in the DynamicValue column, which is of type sql_variant, allowing any type of data - numeric, bit, string, etc. - to be stored there.
My article does not address how to handle multiple-choice questions, where a user may select one option from a preset list of options, but enhancing the data model to allow this is pretty straightforward. You would create a new table named DynamicListOptions with the following columns:
DynamicListOptionId - a primary key
DynamicAttributeId - specifies what attribute these questions are associated with
OptionText - the option text
So if you had an attribute that was a multiple-choice option you'd populate the drop-down list in the user interface with the options returned from the query:
SELECT OptionText
FROM DynamicListOptions
WHERE DynamicAttributeId = ...
Finally, you would store the selected DynamicListOptionId value in the DynamicValuesForClients.DynamicValue column to record the list option they selected (or use NULL if they did not choose an item).
Give the article a read through. There is a complete, working demo you can download, which includes the complete database and its model. Also, the four articles that make up the series explore the data model in depth and show how to build a web-based (ASP.NET) user interface for letting users define dynamic attributes, how to display them for data entry, and so forth.
Happy Programming!
This may not fit you exactly, but here's what i've got at my part-time job.
I have a questions table, an answers table, and a survey table. For each new survey i crate a survey build (because each survey is unique, but questions and answers are repeated a lot). I then have a respondent table that contains some information about the respondent (and it also links back to the survey table, forgot that in the diagram). I also have a response table that links the respondent and the survey build. This probably isn't the best way but it's the way that works for me, and it works pretty fast (we're at about 1mill+ in the response table and it handles like a dream).
With this model i get reusable questions, reusable answers (a lot of our questions use "Yes" and "No"), and a rather slim response table.

Resources