How to autopopulate dialogue list in lotus notes? - lotus-notes

I am having 1 form with 3 fields.
1st field is country,2nd field is state and 3rd field is city.
I configured the values for this fields from other form.
The problem is when i select country it has to display states come under that country and same like for city also.when i select a state it has to display the cities come under that state only.

You need resource documents, where you get the values of states and cities from. Either make a document for each country (containing the states) and for each state (containing the cities) or make only one document containing the states and cities in seperate fields.
Depending on the key (the country selected in your country field) use #DbLookup in your selection formula of the dialogue fields to find the right document/field (depending on which method you use).

In the properties for your Country and State fields, you need to make sure that you have the "Refresh fields on keyword change" property checked. And on the State and City fields, you need to make sure that you have the "Refresh choices on document refresh" proprety checked.
Then you will need a mechanism to do the lookups.The best way is as described by #Lesic's answer. I.e., you e view called "(LookupStates)" where the key column is Country, and a view called "(LookupCities)" where the key column is Country+State. You will pre-populate these views with documents containing the Country, State and City fields. And on your form, the formula for choices in the State field will do an #DbLookup call to the (LookupStates) view and the formula for choices in the City field with do an #DbLookup call to the (LookupCities) field.
Note that both of the formulas have to guard against error cases as well. I.e., the formula for State choices needs to check to make sure that Country is not blank, and the formula for the City choices needs to make sure that Country and State are not blank.

Related

SharePoint unique values from lookup

I have a list with a lookup column that is getting "Created" dates from another list, but I only want the unique date values. Is there a way to get this data or to create a calculated column with unique values?
A lookup field actually links to a single item, the display value is more a "human readable" value for the link to the items ID value.
You may also get some mileage from a normal text or even date field and using jQuery and SPServices on the edit and new forms in order to provide changes to the form for the user. This avoids doing a code level customisation for the site that a Custom Field would require.
Not out of the box I dont think. My best bet is to create a Custom Field type that extends lookup with the functionality you are after.

How to Sort View control by Lookup column

I have two forms that are related and I would to combine them in a view control. Not that difficult. This is for a "1 to Many" type scenario.
Say I have a customer view with the columns customerID and Customer Name. Then I have a view showing the "many" documents that has the columns masterCustomerID, orderNumber, orderDate.
On the XPage I create a view control of the many documents and add the columns masterCustomerID, orderNumber, orderDate. Then I add a column in the front to do a DbLookup to pull in the actual name of the customer. Nothing too fancy really.
My question is, in this situation, where the lookup column is the FIRST column. What are the strategies to sort the view column by that column. By default it would sort by the Key Value in the order view which is likely different then the Name values.
I'm not averse to using repeat controls if that would be easier.
My first thought would be to employ TreeMaps somehow, but I don't know if that's practical in the event that there might be a LOT of documents. Maybe there's something I'm missing...
Any advice would be appreciated. Thanks
Use view with (Customer name, Customer ID) structure as main view. Then based on Customer ID populate other columns by lookup from view with structure (Customer ID, Order ID, Order date). Hence it is 1:N relationship, you can't use single view component, but two nested - repeat inside view column would do.
I hope you are aware of performance impact (orders looked up for every customer row), so don't try to show too many customers at once.

Add up values from matching fields in a linked Sharepoint list

I have 2 lists, say, Fruits & Orders.
Orders has a number field FruitID that links to the ID field of Fruits.
Orders also has a number field OrderValue which stores the value of the specific order.
I want to find out the total sale for a particular fruit. I am doing this calculation in a workflow for the specific fruit. Is there an easy way (read 'no coding')?
See the list of standard workflow actions here:
http://office.microsoft.com/en-us/sharepoint-designer-help/workflow-actions-in-sharepoint-designer-2010-a-quick-reference-guide-HA010376961.aspx
There is no select, or looping functionality.
I suggest writing a custom workflow activity, sand boxing should work
http://www.wictorwilen.se/Post/Sandboxed-workflow-activities-in-SharePoint-2010.aspx

SharePoint Lookup field, what is it?

SharePoint Lookup field, what is it?
Please share, thanks.
It is a type of field used to indicate that the possible values of a column in a list must be taken from the elements of another list. For example, if you have a list of users, and one column of this list is the country, you can create a lookup field pointing to another list "countries" which contains the possible values to select.
If you think in terms of relational databases, a lookup field is a foreign key: you only store a reference to the related item, not its value.
For instance, you have a list of meeting rooms. You can create a meeting calendar by creating a new calendar list with a lookup to the "Meeting rooms" list. Hence, when organizing a meeting, you will be able to pick a room from the list of meeting rooms entered previously.
A "Lookup" differs from "Choice" field as you may alter the source item and the referencing item is updated automatically. For instance, you change the name of a meeting room - all meetings booked for that room will show the new title automatically.

Can I create a COUNTIF calculated column in SharePoint?

Is there a way to create a SharePoint calculated column that returns a count of the number of entries in a list? So If I have 3 customers in my list with the company "Starbucks" I'd like the field to return "3"
(Edited some wording for clarity per suggestion from dariom).
You may be able to get what you want with another list using a not-so-well-known variation of a lookup column.
Let's say you have a list called Companies with values in the title column like "Starbucks", "Peets", etc. Now you also have the Customers list you refer to, but the "Company" column is a lookup column pointing to the title column in the Companies list.
You can add a count very similar to what you described to your Companies list. Go to your Companies list, add a column of type "Lookup" referring to the Customers list and you'll notice that in the drop-down area where you define the lookup if you point back to the Customers list, you'll have a new option called "Count Related". This is here automatically because it recognizes that the Customers list has a lookup pointing back to this one. Select that Count Related option and now your Companies list will have a column counting how many customers are associated with that company.
No coding, Javascript hacks, or anything. Just hidden SharePoint auto-magic.
No, I don't think there's a way to do this using the out-of-the-box calculated column.
Some other ways you could accomplish this are:
Create a view for your list that with a group by on the company field and include the total count. This is easiest, but might not be exactly what you're looking for.
Create a custom column type that executes a CAML query to find items that you're interested in. There is a learning curve if you've not done it before and if the list that you're adding this custom column to has lots of rows, you'll be executing a query for each row which is inefficient - it'll be OK for a small number of rows.
Use an event handler on the list that updates a column value each time a new item is added or removed from a list. This is easier, but can also be inefficient if you have a large number of items in your list.
As dariom said (damn my slow typing skills, +1!), only the current row can be operated on with calculated columns by default in SharePoint. There are a couple of documented workarounds involving SharePoint Designer or jQuery, though.
You can get a Count of specific list items in an XSLT Data View
To do this you will need SharePoint Designer.
Right click on your SharePoint List view (ensure the list view contains the field you want to filter by) select convert to XSLT Data View. Then in the Data Source Windows select Data Source Tab and drag and drop the field you want to get a total on for the specific items into where you want it displayed in your XSLT Data View. Click on the numerical value that is showing you should get a lightening bolt icon, select the drop down and choose Count, then select again and choose Filter. Select "Click here to add a new clause" then choose your field name again and enter your unique value as Starbucks and click OK, you can repeat this process for other fields you want the totals on. You will now see the total number of Starbucks items in the list.
I got something similar to work in a way similar to Niall. Basically, I:
Based on the source list, created a Data View Web Part (DVWP) on a "test" web
part page.
Added the footer column, which gives a count.
Set the filter for my conditions (i.e., the items I want to count).
In the code, deleted the recurring items row.
I was left with just the footer, which displayed a filtered count for all the list items. I further customized the footer by taking out the shaded background. Finally, I exported this web part and imported it onto the page where I wanted users to see a total of items in the list (which met the criteria).

Resources