I have to get several categories names selected by user in NotesUiView. Is it possible? - lotus-domino

I want user to select several categories in categorized view by mouse left-click, so I can write a script to print documents that belongs to different categories without selecting every document.
I have to get selected categories names by lotusscript. Is it possible?
I can get one category name:
Dim ws As New NotesUiWorkspace
Dim uiView as NotesUiView
Set uiView = ws.CurrentView
Dim category As String
Set category = uiView.CaretCategory
But how can I get several categories names, if user selects more than one category?
screen example

Simple answer: you can‘t...
unfortunately there is no way at all to get selected categories, neither by LotusScript not by any other means..
the most you can get is a NoteId... but although it increases when selecting categories further down the view there is no way to map this random id to a real category. I tried for weeks and weeks and used any trick I can think of (and there are a lot of them, as I work with Notes / Domino since 25 years now), but I could not find any workaround.
Sorry to say: you are stuck with this approach... you could show a dialog form with a #DbColumn() on the categorized column and let the user select from a DialogList item or whatever pleases you. But selecting / identifying more than one category in a view is not possible (unless you select the documents belonging to the categories and read the values from them).

As far as I know, this isn't possible in the Notes client, though you could do it with a custom web interface.
There are no officially documented APIs to get all selected categories in Notes.
NotesUIView.CaretCategory, which you have in your code, only gets the category for the selection rectangle, so it only works for a single selection.

Related

Secondary sorting in Magento

I have come across a problem which my developer says there is no solution to.
I have an ecommerce site www.lovefashion.pk roughly 800 products to date. It has categories with collections of products from a particular brand and New Arrivals and Sale pages that show a number of categories. The issue I am faced with is the way Magento displays these products on catalog pages.
We create a custom sort 'BY date' and called it 'Latest' so I would choose a date for a collection and the catalog pages would show the collection with newest sort by date first and so on. Issue is with secondary sorting now. I have products with design codes say Brand A code 1-A, Brand A code 1-B, Brand A code 2-A and so on. When creating these products, we go alphabetically like 1-A,1-B, 2-A etc.
Say a collection has 15 products and i have given all its products a sort by date of 15th April. Magento does the date sorting OK but secondary sorting i.e by product ID (oldest to newest) is what we cant find a way to implement. It shows products now with latest ID first, i.e 20-B, 20-A, 19-B, and so on till 1-A e.g http://www.lovefashion.pk/shop-by-price/
Is there a way to solve this problem? or can SQL manipulation do the trick? Will aprreicate any help
This is a very interesting question. Can you tell us a little more about what you are trying to do? I think you want the products on each page reversed, but the pages to keep the order they have, yes? or do you want the page to go 'Asim Jofa Luxury Lawn Collection 2014 / 1-A' then 'Orient Lawn Kurti Collection 2014 / 01-B' then 'Orient Lawn Kurti Collection 2014 / 01-A' and so on?
Anyway, I think all you need to do is code a secondary sorting of the collection for each page which could be coded in the list.phtml file.
Psuedo code:
get the collection sorted by date and paginated
reverse the collection
pass the collection into the existing foreach(){echo(<li>product info</li>)}
So 'reverse the collection' might be tricky. And strictly you want to sort by sku on 1A, 1B, 2A, 2B - but I'm sure your developer can figure it out.
$reversed_collection = array_reverse($current_page_collection->toArray());
might work but I think the toArray will loose all the class types so it's not the same as reversing the object.
Collections are like arrays so end($current_page_collection) and prev($current_page_collection) might work but you would have to try it (and report back if it works). In that case a simple for loop to iterate over each item of the colection.
If you are making a custom filter then really it is just a case of putting each item of the collection into an array with an appropriate key and sorting with ksort().
So it is my opinion that it can be sorted that way, but it should be done in two stages.

SRSS: Dynamic amount of subreports in a report

it might be possible I'm searching for the wrong keywords, but so far I couldn't find anything useful.
My problem is quite simple: At the moment I get a list of individual Ids through a report parameter, I pass them to a procedure and show the results.
The new request is like this: Instead of showing the list for all individuals at once, there should be a list for each individual id.
Since I'm quite a beginner in srss, I thought the easiest approach would be the best: Create a subreport, copy the shown list, and create a subreport per individual id.
The amount of this IDs is dynamic, so I have to create a dynamic amount of subreports.
Funny enought, this doesnt seem to be possible. This http://forums.asp.net/t/1397645.aspx url doesnt show exactly the problem, but it shows the limit of the subreports.
I even ran trough the whole msdn pages starting http://technet.microsoft.com/en-us/library/dd220581.aspx but I couldnt find anything there.
So is there a possibility, to create a loop like:
For each Individual ID in Individual IDs, create a subreport and pass ONE ID to this?
Or is there another approach I should use to make this work?
I tried to create a 'Fake'-Dataset with no sql query but just for iterating the id list, but it seems the dataset needs a data-source...
As usual, thanks so far for all answers!
Matthias Müller
Or is there another approach I should use to make this work?
You didn't provide much detail about what sort of information needs to be included in the subreport, but assuming it's a small amount of data (say, showing a personnel record), and not a huge amount (such as a persons sales for the last year), a List might be the way to go.
I tried to create a 'Fake'-Dataset with no sql query but just for iterating the id list, but it seems the dataset needs a data-source...
All datasets require a data source, though if you're merely hard-coding some fake return data, any data source will do, even a local SQL instance with nothing in it.

Filtering user access based on tabled responses

I am building a "Survey" type application. The user answers a set of questions with pre-vetted answers.
Question: Where do you live?
Answers: England, Finland, Spain, France, Monrovia
The answers in this case would be in a DropDownList.
Once the user has completed the basic responses (location, age, sex etc) I would like to be able to prevent them accessing the rest of the survey based on their answers.
So for example, if they live anywhere but England I want to direct them to a page which says "Thanks, but Monrovian's can't complete this survey". I need my filtering to be user configurable (Table based) and I need to be able to have ANDs and ORs.
So one filter being the user MUST earn 100k+ a year.
Another being they must either live in Spain, or be female AND like model trains - "100k+ && (Spain || (Female && Trains))"
I would usually use Enums and bitmasking for this, but as my country list is 200+ items long, I can't think of a sensible way to store the filtering.
Hopefully I have made some sense and someone has a decent solution :)
I don't know if I can answer your question completely, but I'll try...
So, we have a bunch of Views that are only visible to the user if she previously chose some answers, like, she will see view#3 if she is older that 30, and view#4 if she is younger than 30 AND from China, and view#5 if she is older than 40 AND from Spain OR Italy, and so on...I want also to introduce the notion of **step**, and for each step we could have 1, 2, or more corresponding views. Each view should have a set of rules (like the ones above) that define if it is displayed or not.
How to create these rules? These rules could be simple instances of a Filter class/interface that, when asked, should return true/false. Like this:
interface Filter {
boolean apply();
}
Then you can create Filters like 'older than 30', 'from Spain', whatever. Remember that each view is configured with a set of rules (Filters) so it can answer yes/no if asked if it can display itself.
Next, how to apply these filters?
We could have a controller object that only knows about **steps** (each step can have one or more corresponding views, as I said), and, after the user pressed **next** at the current step, it should collect the answers and apply them against the rules attached to each view. Like, take the answers from step one, and apply them to all views from step two, and see which one matches (returns true). For example, at step two, you can have two separate views, one for young people, other for old people, and you apply the rules from each view to decide if you show the old or young view.
I could give you one code example, and you could also do research on your own, since I know nothing about your technical environment. I have used Google Guava's predicates on a similar problem and here it is: suppose we are dealing with Witch objects, and each of them has name(string), age(int) and spells(collection) attributes. If I have a list of witches and I need to sort them based on specific criteria, I can do:
// first I want to sort witches by age(natural ordering) then by spells,
// and then by name lexicographically
Ordering.natural()
.compound(new BySpellsWitchOrdering())
.compound(new ByNameWitchOrdering())
.sortedCopy(witchList);
The above line of code is going to take the witch list and return a list of sorted witches according to the criteria. Your situation is pretty similar.
Next, how to create the answers? For each view(page), you have possible answers, like, for view#1, you can have : age, sex, race, country. You can construct some answers, in the form of strings, ints, enums, and pass them to the controller, which in turn is going to apply them to each view corresponding to the next step.
As for how to store the rules in the database, as an example, you could have a column defining rule name (like, OLDER THAN) and one column for value, say, 30. Again, I do not know that much about your environment, and it is a really general issue, so I will stop here...

OpenERP customers separation

Please I would like to know ho to separate customers in category, since we have two type of customers, the first group should only appear in crm->customers only and vice versa to avoid having a huge list of customers when searching.
My first attempt is to add a tag to different customers to separate them, for example the crm customers have the tag name Mass mailing is it correct to achieve this with tags ?? and my second question how to set default search keyword for example if I click on sales -> customers how to set the default value of search box to for example crmOnly tag thanks.
you can use "domain" where ever you want to have a such a separation.

MS Access 2007 - Select multiple records and assign a value into a field

I am using a Multiple Items Form to list CASES (records) where there is no TECHNICIAN assigned (Maybe I should use a Datasheet to list the records?).
I would like the user to select a TECHNICIAN from a dropdown field that gets its values from an Employee Table (I can do this). Then I would like the user to select multiple CASES (records) in order to assign that one TECHNICIAN to the Technician field in all of the selected CASES.
Basically, I'm trying to keep the user from having to assign a technician from within each and every incoming case request. I want them to "batch" assign a tech to multiple cases.
Can someone point me in the right direction?
Ok so I did some more research. This may not be the best answer but it works for now.
I created a Multiple Item Form.
I added an unbound dropbox that lists Employees from the table
I added a button on the detail section (for each record) with the follow line of code:
Me.Technician = Me.Choose_Technician
Now the user can pick a technician from the dropdown and then click the button to assign that technician to the record/casefile.
This is a simple solution if you only have a couple of records/casefiles to assign. If the amount of incoming casefiles increases there will have to be a way to select multiple records using the shift key. I'll keep researching this.