windows8 - output object data as a table - windows-8

I have a class C1 with members Name and Value. I have an ObservableCollection C1Coll which will have around 10 to 20 items. I need to write this data out in an email as a table when user clicks on the email option.
Any ideas?

Related

MS Access 2016: Avoiding entering the same data multiple times

one of my table keeps track of assets that has been assigned to different customers. For example, I have a field named "Location" which is a list of devices and a field name "Customer"
The 1st 2 or 3 letters of "Location" is unique to the Customer's name, for example let's say the customer name is "All About Customers", my Location will be AAC001, AAC002, etc. The sequence continues indefinitely.
When adding records, I would type AAC010, AAC011, AAC012, etc. and then I would have to select from a drop down box which customer these belongs to, if I'm adding 40 records, I'd have to select the same customer 40 times.
Is there away to let access know which Customer I'm preferring to based on the 1st 2 or 3 letters of my location?
Not gonna talk about the flaws in this approach in terms of database modelling and rules etc.
But to do some vba code, you just have to define the OnChange event of the desired control e.g. TextBox
Whenever there is a character entered you could execute code.
(in example it would happen only if text has 3 or more characters)
Public Sub OnChange()
If Len(Textbox) >= 3 Then
'Do Something
End If
end Sub
My time is limited right now, so I can only provide you with my approach and not the actual code:
I would create a separate table named Customers.
The table should have the two fields (test data in parentheses):
customer (All About Customer, The Store)
customerAbbreviation (AAC, TS)
On your form, there should be a macro fired after the update of the form's Location field.
The macro should have some type of code that separates the numbers and text in the Location field. Using All About Company as an example, the macro should return AAC and 001.
You could search the Customers table for the customer whose customerAbbreviation is AAC.
You could then set the form's Customer field to the All About Company, or whatever's returned in the above line.

Laravel get a random user with where clause

My table schema is a id field, name field and a friends id field.
Every user must have a maximum of 2 friends. When a new user is created and event is fired and a listener which listens to the created user event then adds a random friend to a newly created user.
$randomfriend = DB::table('users')->select('id')
->groupBy('friends_id')
->havingRAW('COUNT(*) < 2')
->inRandomOrder()->first();
it still returns users with maximum number of friends. Can someone help me with this?
first of all create another table for friends relations.
for selecting a random user this post can help you:
enter link description here
don't forget to put this code in while loop for checks.

Select certain rows from a result set. MS Access VBA

This could be bit complicated. I will try to explain as much as I can.
Say for example i have a table called "Job". In this table there will be multiple entries for a same Job ID (Job ID is not Unique). The current system enables a user to search for a particular Job ID and return all the rows having the same Job ID on a form as shown below:-
Job ID | Item Name | Date Completed | Generate Report?
------------------------------------------------------
JB001 Door 25/12/2012 []
JB001 Window 02/01/2013 []
JB001 Blinds 10/01/2013 []
JB001 Carpets 15/02/2013 []
I would like to implement a feature where a user can select multiple rows from this result set (using the check boxes) and generate another form/report form he selections. For e.g. if the user ticks check boxes next to Window an Blind and then clicks a button, the next form should display these selected rows.
By the way, I am using MS Access.
The problem I am facing is haven't got a clue as to how to implement this i.e to select certain rows from the result set.
Thanks in advance.
Perhaps youre thinking in too much code, could you formulate a query that uses the job ID from a form and the check box as a where condition?
You could base the report off of the query and as long as the form is open when the report is opened the query can use its fields. In the where box type [Forms]![frmFormName]![FieldName]
That should get you started.

LightSwitch HTML Client save calculated results to new field

I'm using Visual Studio 2013 LightSwitch to attempt to build an HTML application. After trying for several hours to get a "computed" column/field to show up in the HTML client, I realized it's not possible. I thought about building a trigger to fire on the table, but that won't get pushed when I publish the application. So, without using a RIA client, what's the best way to calculate using two or more datasource fields and store in another? It can be triggered when the user clicks the save button or even when the fields contain data that can be computed.
For example, Table Users (before):
First_Name (string) Last_Name (string) Stored_Full_Name (string)
John User NULL
Jane Doe NULL
When the user clicks save, or when first_name and last_name are not null, "Last_Name, First_Name" is stored as a single column in the Stored_Full_Name column in the same table.
For example, Table Users (after):
First_Name (string) Last_Name (string) Stored_Full_Name (string)
John User User, John
Jane Doe Doe, Jane
I'm assuming the same technique could be used to calculate costs or other items?
Any example code would be greatly appreciated.
For simple computed properties, you can always create functions on the Users prototype.
It's explained in this blog post: http://lobfactory.wordpress.com/2013/05/03/computed-fields-in-the-html5-client/
This is pretty easy. Create a string-typed screen variable called "FullName" with display text of "Full Name". Edit the Screen's "create" method and assign the value you want to the variable in JavaScript. - in the example above you'd want something like the following:
screen.FullName = screen.Last_Name.value + ", " + screen.First_name.value;
Then drag the variable from the data tab on the left onto your screen into your Users table.
You might need to update the computed value as part of your Save pipeline, but the create() method should fire any time the screen is redrawn. If you want to save this into a nullable column within your Users table you can do so by simply assigning the field value to the new value, but I'm not sure why you'd bother as this breaks your table's normalization. In the function where you pre-process saved changes on the client-side, add the following code to make this so anyway:
screen.FullNameTableField = screen.FullName.value;
I use a very similar technique for creating in-row "Edit" and "Delete" record-level table entries.
HTH

Dynamic List Box In A Form

This question involves 3 tables and 1 form in my Access database.
The tables are:
- Contacts
- Customers
- Contacts to Customers Relationship
The form is:
- Manage Contact
What I want. A list box that displays the output of this SQL query:
SELECT Customers.AccountName FROM Customers INNER JOIN [Contacts to Customers Relationship] ON Customers.MasAccountNumber=[Contacts to Customers Relationship].MasAccountNumber WHERE [Contacts to Customers Relationship].ID = 3 ORDER BY Customers.AccountName;
Where you see the "3" in the above SQL statement I would like to have a dynamic value there. Something that references the current records value for the ID column (Contacts table). If I have to do this in a VB script adjusting the list boxes RowSource where would I do that? onLoad for the form doesn't seem to make sense because when someone clicks to change records or add a new record I want it to update for that "Contact" (record).
Any help is appreciated.
TW
The resolution to this lies in using the forms Current() method. That causes the form to re-execute the query that is bound in the RowSource property for that list box each time a different record is accessed in the form.
Thank you for your response Mr. Fenton.