How to sort data from DropDownList component? - flex4

I'm developing a simple Web App which has a simple data from some employees, such as ID, NAME and so on. Thus, I'm using a XML file as my database. Yet, my XML file is sorted by the Employees' ID.
However, I'm using a to select the Employee's Name and show some informations about him/her, but when I created the bindable data through my spark component (I just "drag-and-drop" my XML file into the component), I'd like to show those names sorted by Name and this is my problem.
It's suppose to be a simple code, but I'm in trouble with it... lol!
<s:DropDownList id="ddNome"
labelField="NomeFuncionario" <!-- Employees' Name -->
textAlign="justify"
width="240" height="25"
top="30" horizontalCenter="0"
initialize="sortName(event)" <!-- Trying to create it now... -->
creationComplete="cbNome_creationCompleteHandler(event)"
change="cbNome_changeHandler(event)">
<s:AsyncListView list="{getDataResult2.lastResult}"/>
</s:DropDownList>
I'd be really grateful for any help with this code.

you can try something like this
<mx:XMLListCollection id="xmlListColl"
source="{getDataResult2.lastResult}">
<mx:sort>
<mx:Sort>
<mx:fields>
<mx:SortField id="sortField"
name="#NomeFuncionario"
caseInsensitive="true" />
</mx:fields>
</mx:Sort>
</mx:sort>
</mx:XMLListCollection>
...
<s:AsyncListView list="{xmlListColl}"/>
...

Related

Retrieve data from Dynamics CRM Online custom report through API

I am trying to read data from a custom report in CRM Online through the API.
I have no problem fetching data like competitors, accounts using
OrganizationService.RetrieveMultiple()
But when it comes to custom reports, I can't find a way. The report I would like to read is found in the CRM web interface under Dashboard -> (My organization) -> Reports.
I hope someone can point me in the right direction. Thanks!
I am also interested in this. Did you ever figure it out?
Sorry about not leaving this as comment, but apparently I don't have permissions.
Actually, I may have stumbled on the solution.
I noticed that when you download the report definition it has a field called d:CustomReportXml. In my custom reports this field contains XML code.
<d:CustomReportXml><CustomReport><Language>1033</Language><Query><fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="appointment"><attribute name="createdby" alias="createdby" /><attribute name="createdon" alias="createdon" /></entity></fetch></Query><Groupings /><Columns><Column ID="createdby0" Field="createdby" Width="100" /><Column ID="createdon0" Field="createdon" Width="100" AddRawValueColumn="true" /></Columns><TableLayout Display="Normal" /></CustomReport></d:CustomReportXml>
inside the XML is a fetch tag
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="appointment"><attribute name="createdby" alias="createdby" /><attribute name="createdon" alias="createdon" /></entity></fetch>
I have been able to parse this out and pass it back to dynamics via the api and get back results. I am using http://www.xrmtoolbox.com/ to test the results and so far things look promising.
I can also add a filter to the fetchXML so I don't end up with too much data.
I hope it helps you.

JSTL getting value in EL from another EL value

In my JSP page, I am iterating over a list of objects using the c:forEach tag. Each object in this iteration has a name field, and I am trying to use that name field to reference other objects that I have added to my Spring model. However, when I do this, I am getting an exception saying the property of the second object cannot be found on a String. Let me illustrate with a simplified example.
<c:forEach items="${companyList}" var="company" varStatus="num">
<c:set var="monthStats" value="${company.name}_month" />
<tr>
<td>Properties This Month</td>
<td>${monthStats.properties}</td>
</tr>
....
</c:forEach>
All of the objects are located inside a Spring Model object and have been set like this
model.addAttribute(company.getName() +"_month", currentMonthStats);
I have also tried throwing out the <c:set tag and trying
${(company.name + "_month").properties}
as well as
${${company.name + "_month"}.properties}.
Those havent worked either. Also, I wasn't quite sure how to word my title, so if it could worded better let me know so that other people can find this if they have the same issue.
You're basically asking for double-evaluation, and it doesn't work like that.
I'd modify the data delivered to the view layer to be something a little less odd, so you can access it in a non-pathological manner, like by putting the month stats into a map accessed by the company name (or id), or directly associated them in a DTO, etc.

How to dynamically change the element definition of a region in content presenter template in Webcenter Portal?

I have been following Yannick Ongena's tutorial http://yonaweb.be/webcenter_tutorial/using_content_presenter_templates
I am looking to alter some code in the content presenter template "training-list-item.jsff" so that the region definition will have a dynamic value.
That is, rather than writing
<af:outputText value="#{node.propertyMap['RD_TRAINING:description'].asTextHtml}"
escape="false" id="ot5"/>
I am looking to write like
<af:outputText value="#{node.propertyMap['xRegionDefinition:description'].asTextHtml}"
escape="false" id="ot5"/>
Unfortunately, this does not work. If I write only "xRegionDefinition" within the propertyMap,it displays the region definition name in the portal, that is "RD_TRAINING". But I am looking to display the value of element definition within the region that is, the "description".
My objective is to display different region definitions at the portal rather than a hard coded fixed region. I have wrote some Java code also to dynamically change the CMIS query to supply a new value for the region definition:
if(news){
query = "SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xRegionDefinition LIKE \'RD_TRAINING\'";
}
else
query = "SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xRegionDefinition LIKE \'RD_SWEDISH\'";
Please help. Hope I am clear in explaining the requirement.
Why don't you use ADF Switcher component if you only have 2 options!
Check this video to know how to use it

How to specify composite action variables in magento dataflow xml profiles

I have created some custom actions to use inside a Magento Dataflow profile. I would like to pass in composite parameter values (arrays or dictionaries) to the action, similar to the map var you can pass to the default parser actions. I.e., I would like to do something like this:
<var name="attribute_map">
<map name="sColore"><![CDATA[colore]]></map>
<map name="sMarca"><![CDATA[marca]]></map>
<map name="sFornitore"><![CDATA[fornitore]]></map>
</var>
The variable turns out as null in this case, although, upon fiddling with the xml and skimming through the code, it seems that this pattern only works with <var name="map">. Puzzling and disappointing. I also have not been able to find even the slightest hint about the relevant xml schema in any documentation whatsoever...
Any idea on this? Thanks!
(I am working with Community Edition version 1.7.0.2)
If i understand right what you ask, you could overwrite the system/convert/profile/wizard.phtml from admin and add another section similar to existing map but the form elements should have name="gui_data[attribute_map]...[]".
Then you should overwrite the _parseGuiData method from Mage_Dataflow_Model_Profile to form the correct profile actions xml.
Hope that helps.
You can't, using the core implementation.
The var elements can only contain simple text, unless the element has the attribute name="map", in which case the profile parser will search for children map elements and use them to populate a php associative array.
The relevant code is inside the importProfileXml method of the Mage_Dataflow_Model_Convert_Profile_Collection class:
if ($varNode['name'] == 'map') {
$mapData = array();
foreach ($varNode->map as $mapNode) {
$mapData[(string)$mapNode['name']] = (string)$mapNode;
}
$container->setVar((string)$varNode['name'], $mapData);
}
To extend this behavior you should override this class with a custom (sub)class through the usual magento class override methods.

Core Data traversing entities with an NSArrayController content set?

I have 3 entities in a Core Data application:
Projeto <-->> Servico <-->> Sessao
(the relationships are named as usual).
Projeto.servico (to many Projeto --> Servico)
Servico.projeto (inverse to one Servico --> Projeto)
Servico.sessaoDoServico (to many Servico --> Sessao)
Sessao.servicoDaSessao (inverse to one Sessao --> Servico)
Each entity is connected to an array controller, like "Department and employees" in Apple Docs. It's Working fine in a typical Master - details configuration.
Now I want to have all Sessions from a selected Project. (I don't have a relationship between Sessao and Projeto)
I'm trying to bind the SessionArrayController Content Set to filter the sessions without success.
How could I have all sessions for a selected project?
I created a property for the Session Class, returning a NSSet and I can print the desired sessions, but I have no idea, how I could do it with binding.
-(NSSet *)sessoesDoProjeto{
NSSet *allSessions = [self.projeto.servico valueForKey:#"sessaoDoServico"];
NSLog(#"allSessions %#",allSessions);
return allSessions;
}
Could I create a NSArrayController with the above NSSet?
Any help would be appreciated
I found the solution, so I'm posting for others with the same problem.
I bound the Content Array (not content set) of the SessionArrayController to:
ServicoArrayController_by_Project.arrangedObjects.#unionOfSets.sessaoDoServico
It works like a charm!

Resources