rhomobile Listing ActiveRecord objects alphabetically - rhomobile

How can i create a queryset and view (#contacts in my situation) in rhomobile to list ActiveRecord objects alphabetically?
I'm trying to do this implementation;
A -> Contacts starts with A
B -> Contacts starts with B etc.
Final look: http://jquerymobile.com/demos/1.0b1/#/demos/1.0b1/docs/lists/lists-divider.html
Thanks

The simplest thing for you would be to sort your queryset and place listdividers (as you would do with jQuery Mobile) in your ERB file whenever the next element starts with a letter that is different from the one of the previous element (this could be achieved through a for-each loop).
I am assuming that you are using the Contacts API from Rhodes (Rhomobile). In that case there actually is an example here where they sort the contacts according to display_name. It should however be noticed that the display_name property only is available on the Android platform. You may therefore want to substitute it with the first_name or last_name properties that are supported on all platforms.
You can find another reference that explains sorting in Ruby here.

Related

Get all Collections that are declared on document Swift Firestore Firebase

I have a document (lets call it d1) that has multiple collections.
d1(FirestoreDocument) -> Collection1, Collection2, Collection3
These collections each have a unique name (in my case a date string with the format dd.MM.yy).
I need to retrieve all the documents that are that one collection. The problem is that I don't know how I can access a collection that I don't know the exact name of. Is there a function for firebase Firestore where you can for example call document.getAllCollections(completion...) and then get the documents for each collection individually?
There is a function for listing all collections called .listCollections() however it is a server-side function.
Meaning it's not available for client/mobile libraries
Since Swift is a mobile language it is not available there to my knowledge.
However, since you're formatting the subcollections as dd.MM.yy that means the subcollections are predictable (to a degree), so you could store a list of the subcollections a document has within it and then iterate over that list as a workaround, or iterate over a breadth of dates.
Another workaround would be to call listCollections server-side (assuming you have a server for your application written in Java, Python, Node.js, Go, PHP, C# or Ruby), and send that list of collections as a JSON array back to your client so it can iterate over it.

Accessing objects by attribute Value through DXL

We are accessing Doors from an external .Net-program via DXL.
In that program we are currently getting all Objects linked to that Object through their modulname/absolute number from their links.
Now we have to neglect those, because we got an attribute grouping certain objects together (lets call it GroupID) and we need to link through GroupIDs saved in another attribute in our source object.
The actual question is, if theres any way to search objects for their certain attribute values?
I didnt find anything useful in the DXL documentation and the only way I can imagine right now, is iterating over the objects in a module an compare the attribute.
I don't know how you transfer the objects from DXL to .Net, if you use DXL scripts for preparing the objects and sending them, so this might not apply for you:
In DXL, you could use a filter (see chapter 25 "Display Control"→"Filters" in the DXL manual) and then use the "for Object in Module" loop that will traverse all filtered objects. But if I remember correctly, filters are internally implemented using something like a "for Object in entire Module" loop, so you might get the same speed using a manual iteration.

Dialogflow - Entity with different reference values and similar synonyms

Help me to resolve the query for Dialogflow agent!
I've defined an entity called "ProgrammingLanguages" and assigned 2 different reference values with common synonyms like below :
Android - Mobile OS, Mobile Development, Google
iOS - Mobile OS, Mobile Development, Apple
Already defined a intent with parameter named "ProgrammingLanguages" along with isList selected "Yes"
Now when I ask my agent "Show me the list of mobile os", it always returns "Android" only! when I replaced the sequence for values inside entity, it started showing me "iOS", That means, it's always taking the first value and didn't show all the values with similar synonyms for that particular entity!
Could someone help me to understand this behaviour?
Thanks,
This will not work correctly. You cannot put same synonyms for different Entity values. If you are using the same synonyms that means the two entities are same.
isList is used to capture multiple values for a parameter like if I am collecting brand names of cars, my entity will be car_brands and user can provide single value or multiple like Ferrari, Benz, Bugati, BMW or only Suzuki.
If you ask your agent "Show the list of mobile os" that means, it should return Android and iOS. Entities are not used to return response values. They are used to capture category for which you want bot/agent to return value.
In your case,
create an Entity and put all the above synonyms under one say "mobileOS".
when the user uses synonyms, mobileOS will be the captured parameter.
use it to decide and return all the mobile OS.
You don't need to enable isList as you are not collecting a list of values from the user.

In Twitter, how to filter the results of a list?

I have created a list - LL (for linguistics list) - containing 2 members :
languagelog (http://languagelog.ldc.upenn.edu/nll/)
languagehat (http://languagehat.comBut i
The list, of course, works fine. But suppose I would like to :
exclude languagelog's tweets containing "chinese"
include languagehat's tweets only if they contain "russian"
I know how to do that with one search operator :
(from:language log -chinese) OR (from:languagehat russian)
but it seems it could be interesting to do that via lists, which would allow longer and more complex searches (it might even become a sort of substitute for yahoo pipes, although a very simple one).
Is it possible to include search operators in lists ?
Thanks in advance
This is the correct search query for the separate accounts:
(from:languagehat OR from:languagelog) lang:ru -lang:zh
If you'd like to do similar with a list:
create a Twitter list and add the accounts you need into it.
click on your list and copy the list ID from the browser's URL line the list ID.
in the query below, replace [list_id] with your copied list IDlist:[list_id] lang:ru -lang:zh
paste the query in Twitter's search box
Of course, as you suggested, you can build longer and more complex searches on that list.

How to pass a list (comma separated) to a traffic variable in Omniture?

I have a field "taxonomy" and I would like to pass it to Omniture. This Taxonomy field can have multiple values and I would like to calculate the count for each of the taxonomy separately. Let me explain my question with an example:
Item can be associated with multiple taxonomy. Letz say we are talking about an item called "Item1". This item can be associated with taxonomy "Tx1","Tx2","Tx3".
So the js code will be like,
s.prop1 = "Item1"
s.prop2 = "Tx1, Tx2, Tx3"
I was expecting omniture to store individual buckets/counters for "Tx1" "Tx2" and "Tx3". But Omniture created one bucket for "Tx1, Tx2, Tx3". I hope there is a way to treat them separately. Ideally I would not like to pass the taxonomies separately in separate prop variables.
I would appreciate if someone can point me in the right direction.
Thanks,
Rag
Actually Omniture does support list-style props, aptly called a list prop. You have to talk to Client Care to enable it for your prop, and you will need to specify a delimiter to use (like the comma). Then you would populate it exactly as you are doing, except without the space between the comma and value. ("a,b,c" not "a, b, c").
An alternative is the list eVar as Racheet mentioned. The difference is that a list prop sends in values and each value is within a prop variable scope, vs. the list eVar values are recorded with an eVar scope.
If you decide to do it w/ a list eVar instead of list prop, read up on how Omniture handles the allocation for them..there are some implications to consider with them only being able to be set to first or last allocation...
Omniture does have the functionality you're looking for from version 15 onwards. Unfortunately it won't do it in a prop. You need to use a slightly different variable type. The variable you're looking for is a list eVar.
Every implementation has three of these available:
s.list1
s.list2
s.list3
Here's the blog post where Omniture introduced them.
You can also find information on them in Knowledge Base article 10549 from inside the Adobe Marketing Cloud interface.

Resources