Using variables to access a class module field - ms-access

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.

Related

Microsoft Flow - Object variable issue/Question

I have a flow. In that flow, there is a case statement based on Document type.
After this case statement there will be an object populated with some metadata. I want to store this object against a variable. So that i can create the object later in the flow, no matter what case was selected.
I have two issues:
To set an object variable, i can't use the Word Template object, because it may be one of two.
My question on this is, how would I populate the variable with the correct object that was just populated in the Statement?
When i try to create a document using the variable with the object, i can't open the document. Can you create an object using an object that is stored in a variable?
After i create a document using the object stored in the variable, this is what I get. I can only assume that the create file method doesn't like using object variables?
Any help would be much appreciated.

JRDataset property CSV file

I have a build up a report with a .CSV input file as DataAdapter. After that I needeed a table to put some data into a it and a linked dataset. The problem is: if I leave blank the section "Default Data Adapter" in my Dataset1, no data will be displayed. In fact, to fix this report I had to export my DataAdapter as myDataAdapter.xml and then put this file in the section "Default Data Adapter" of my Dataset1 (as shown in the attached picture).
Working with database I have never set up this property.
Is there a way to pass this property as Param? (I have a java code in which I call jasperReport and I want to pass this object dinamically).
Or is there a way the report works without setting this property?
In the section Table>Dataset I have this situation:
where I set up JRDatasource expression, but it is not working...
I have one more problem. Can I set dinamically the location of my .csv inside the DataAdapter.xml?
Is it possible to implement "myDataAdapter.xml" from java code and pass it to the report??
Thank you in advance!
In Java code you can set properties on the net.sf.jasperreports.engine.JasperReport instance like in this sample here, from the official repository. The relevant code looks like this:
...
JasperReport jasperReport = ...
...
jasperReport = (JasperReport)JRLoader.loadObjectFromFile("build/reports/ExcelXlsxQeDataAdapterReport.jasper");
jasperReport.setProperty(DataAdapterParameterContributorFactory.PROPERTY_DATA_ADAPTER_LOCATION, "data/XlsxQeDataAdapter.xml");
...
The property of interest is net.sf.jasperreports.data.adapter and is stored in DataAdapterParameterContributorFactory.PROPERTY_DATA_ADAPTER_LOCATION
The data adapter file is a convenience method to pass a series of parameters from which a net.sf.jasperreports.engine.data.JRCsvDataSource is built. If you want to skip passing this property, you would have to manually provide the built-in parameters listed in the net.sf.jasperreports.engine.query.JRCsvQueryExecuterFactory.CSV_BUILTIN_PARAMETERS.

django using variable in request.POST.get('x')

In my current project, users can create spreadsheets with fields, then each field inherits a unique ID based on the column it is attached to in the spreadsheet, so when fields are updated, my template looks like this:
<input type="text" name="{{field.unique_id}}" id="{{field.unique_id}}" value="{{field.data}}">
But in my views, when I attempt to grab the value from the field:
request.POST.get('field.unique_id')
It sees nothing because it's looking for literally 'field.unique_id' and not the variable that field.unique_id would produce.
Is there a way to tell it to replace field.unique_id with the variable or do I have to define the id of the POST get manually?
You can use a variable in request.POST.get() instead of a string, for example.
request.POST.get(my_var)
However in your case, request.POST.get(field.unique_id) does not work, since the keys in request.POST are strings, and field.unique_id is an integer.
The answer is to use str() to convert it to a string.
request.POST.get(str(field.unique_id))

SSIS Get data from a Flat file and assign to variable

In SSIS, i want to read data from a flat file(Flat File Source) and assign certain column values to a variable in SSIS (like IDNo). I need this ID to retrive other information like email and other details to send email dynamically later in the process.
I did some reasearch i found that Script Component is one of the way to assign values to variables, but in our environment script component is not available. Is it possible to do that if so, can some one please provide me a sample. thanks.
You don't necessarily need script component to achieve this.
Read your IDs to a recordset (that would be a variable of type Object):
Create a variable of type Object.
In Data Flow Task create a Recordset Destination.
Pick your variable in VariableName dropdown.
Create Foreach Loop Containter:
Choose Foreach ADO Enumerator in Enumerator setting.
As ADO object source variable pick your recordset variable from the dropdown list
In Variable Mappings assign your email variable with index 0
Send the emails from the loop using email variable as an expression in Send Email Task.
Why is script component not available? It'd make things easier and help to avoid some problems; I don't use mail task anymore in favour of script task, because I ran to some problems with it in the past.
Hope this helps.

Using a variable in multiple views

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.