Using a variable in multiple views - actionscript-3

I'm working with flash builder (flex) and wanna assign value to a variable in a view and use that variable in other views.
but the problem is when i define for example an array in one view it's undefined in other views and i cant use value of that variable in my functions.
whats the solution?

You have to create a reference the view which has your variable in the other view .
Make sure that your variable is public and bindable.

Related

Wanting to display a method return using HTML 5 data attribute

So I have a dynamic table in angular where im passing data in, then creating the table. I want to add some CSS in order to check the values then add some styling onto it. So if the value is a minus number, then display the data in red
I have used attribute data to check the actual data, which works fine until i call to typescript method to generate the data instead of hardcoding the data in, and this is where is goes wrong. So I want to call this method to get the data instead, and it just displays the method name instead of the method return
You can use the attribute binding of data instead of the interpolation if the data returned by the method is not a string - more details here
[attr.data]="getData(header, body)"

Using variables to access a class module field

I am trying to use a loop to access some variable information within a class module in Access 2016.
If I am using a DAO instance such as rst!Name, and want to use a variable in a loop I can substitute to this version, rst(variable), where variable = "FirstName" or some other field name to get the same answer.
If I am accessing the field "FirstName" from within a class named "clsPerson" with a line such as clsPerson.FirstName, and want to use a variable for the field name ("FirstName" or others such as "Address", etc. provided by a loop), is there a way to code that in VBA? In DAO I would use clsPerson("FirstName") but that doesn't seem to work. Is there something that does?
You could create a "common" property like:
clsPerson.CommonProperty("FirstName")
and in this have a Select Case construct to get/set the actual clsPerson.FirstName.
But that's about it.

Umbraco razor template - Get Formatted Date From Field specified in parameter

I'm trying to return a formatted date from a razor template in umbraco. I'm not sure how to get a value from a field defined in a parameter though.
Here is the code I'm playing with. The field I'm passing in is called "articleDate". I'm getting the parameter value output, however when I try to get the value of the field using the parameter name it returns nothing. If I ask for the value by the field name itself, that works. How can I create a generic macro like this?
#{var param = #Parameter.dateField;}
Field Name: #param
<br/>
Field Value: #Model.param
<br/>
Field Value: #Model.articleDate
I tried using #Model.GetDynamicMember(..) as well, but that just throws an exception.
Field Value: #Model.GetDynamicMember("articleDate");​
Error loading Razor Script getDate.cshtml
Cannot invoke a non-delegate type
Can someone point me in the right direction? I'm just trying to create a simple macro I can use to format dates across my page.
Is it possible to pass the value of my date directly into the razor macro? This is how I'm currently calling it:
<umbraco:Macro ID="Macro1" Alias="getDate" dateField="articleDate" runat="server"></umbraco:Macro>
If you call your Macro like you wrote:
<umbraco:Macro ID="Macro1" Alias="getDate" dateField="articleDate" runat="server"></umbraco:Macro>
You're actually passing the name of the field "articleDate". In the macro, you then may get the value of the Model's articleDate property by using:
Field Value: #Model.getProperty(Parameter.dateField).Value
Instead of macro's I also recommend using helpers or - for more complex scripts - RenderPage. A nice writeup can be found here:
http://joeriks.wordpress.com/2011/03/11/better-structure-for-your-razor-scripts-with-renderpage-in-umbraco/
Example:
#helper GetDate(dynamic dateField)
{
#dateField.ToString("[yourFormat]")
}
You may pass parameters to scripts rendered with RenderPage by using the Page object:
<umbraco:macro language="razor" runat="server">
#{
Page.dateField=Model.articleDate;
}
#RenderPage("~/macroscripts/getdate.cshtml")
</umbraco:macro>
getdate.cshtml:
#Page.datefield.ToString("[yourFormat]")

intellij - bind jcombobox to arraylist

I am using intellij and I have an arraylist which I want to display its toStirng.
I want to accomplish the following
1. iterate through its value and get the object value,
2. when changed - get the object not only the string
will I have to mark the custom create in intellij and to create it myself ?
thanks.
Yes, using Custom create property is the preferred way for such cases.

Custom code in Reporting Services report

In Reporting Services I would like to add a parameter that contains data from a custom code block. Ideally, I would be able to run the following code (this is a simple testing example):
Function GetPeriods() As String()
Dim values As System.Collections.ArrayList =
New System.Collections.ArrayList()
For i as integer = 1 to 24
values.Add(i)
Next
Return values.ToArray()
End Function
and put the following in the "Text Field" of the parameter:
=Code.GetPeriods()
However, when I run the report, the parameter I apply this to is disabled and empty. Is there a different technique that should be used? Or am I doing something wrong?
If you're using SQL 2008 Reporting Services then you can have a look at this page which introduces the concept of using custom assemblies.
If you're using SQL 2005 Reporting Services then this link is the one you want.
It's a mostly trivial thing, simply compile your code into a class library and follow the instructions provided to allow your report to reference it.
You are returning an array item (an array of strings) into a text field. Instead, try returning a plain string. That should work. If you would still like to return an array list, you must basically bind it to a list control in your RDL. You can definitely do that with dataset extensions. However, I am not sure if there is any other easy way. Check the proprties of the list control and see if it allows you to directly bind to an array list.
You can create the same stored procedure on SQL Server and load parameter values from that procedure.
To access your members/functions implemented in custom code of SSRS report you should set the access modifier to "Public":
Public Function GetPeriods() As String
...
see article Writing Custom Code in SQL Server Reporting Services
I've been trying to do this same thing, set a simple list of parameter values from report code. None of the links in any of these answers shows how to do this and after quite a bit of digging around I don't think it's even possible. Yes it is possible to get the values from a database query, from a web service, or from a custom assembly, but each of these creates a lot of overhead compared to getting the list from a simple function call like =Code.GetValues(), where the function uses a For loop to create the values.
msvcyc is correct in pointing out that the parameter is expecting a string value, but the function is returning an array. I changed the return type to Array as suggested by prashant sable, but the select list is still grayed out, it does not work. And coldice is correct in saying that the access modifier should be Public.
In my digging around I found an article by James Kovac from 2005 that pointed out why this is not possible. The Parameters class has a get method, but no set method. In the VS 2008 object browser for SSRS 2008 the object name has changed, but it still does not contain a set method (see Microsoft.ReportingServices.Interfaces.IParameter.Name or .Value).
My current workaround is to just hard code the list of values, but if your value list needs to be dynamic then your only choices are database queries, web services, or custom assemblies. I think the easiest workaround of these three is to get the values from the database engine, as suggested by oleksiy.t, as long as you can write a query to return the value list you want. Your list of integers, or my list of time intervals, would both be easy queries to write. Otherwise you will need to use one of the other two workarounds.
I checked your code. The only thing that's wrong is your function returns String(). When I changed your method signature to return Array, it worked fine, in my report.
Change the signature to Function GetPeriods() As Array
Everything I've seen requires parameters and their respective settings to be part of the RDL.
That being said, if you're going to "hardcode" the values, you could create a dataset just for the report, perhaps in XML, or if it needs to be programmatically driven, do it in a web service.