Assign the selected value to a variable - qliksense

I have a customers Field loaded from a DB server and I have it on my sheet in a Field object or table object. My question is how can I assign the selected customer to a variable?
Thanks in advance.
Ziad.

Related

Dynamically Selecting Data from Table in Entity Framework

I know this question might have been asked before but I have not found a single answer yet.
Basically I am using entity framework and I am in need of selecting data from a database without knowing the name of the table, as this will be generic.
Now if I do not know the table name, I do not know the type too as I have tried using context.Database.SQLQuery or context.Database.ExecuteSQLStatement but these all require the type of the object it should be expecting.
All I am receiving as parameters are the name of the table and the row ID.
Could anybody give me further advice?
Thanks.
#
Edit:
I have just been notified that the only property I would need from this table is the Name field...

Symfony: get new ID in a form

I have an object displaying within a form, a hidden field being related to its PK (field id).
When I create a new object, the field has a null value. Submitting the form, the object is inserted into the DB and it now has an ID, but the field in the page still has a null value.
If a reload the page, now the ID is indeed set in the hidden field.
In my opinion, this is due to the form processing of Symfony: when a create an object, it creates a form, with this form valid the object is saved but the form still uses the data before it was saved.
The question is: how to get the auto-incremented key in the form up-to-date? Shouldn't the form only have a reference to the object? Can't the value be updated?
make sur that you call $entityManager->flush() method after insert and that you bind your form whene you have same data in your request object
$form->submit($request->request->get($form->getName()));
You should have an Entity assigned to your Form by FormFactory. Then Symfony will fill that Entity with submitted values. What's left is only persist the Entity and flush to database.
You can find steb-by-step form submission in Symfony Cookbook

how do I create Reference attribute using CloudKit Dashboard

I created a record using CloudKit Dashboard, so record is NOT created programmatically. Under "Default Zone, Model Data" (Sorry I need at least 10 reputations to post images.. :/ ) So here's the texted version.
"EventRef0 975f5715-3ccd-4c5f... DeleteSelf Reference"
So I have 3 reference field like this in records that I crated.
Now Under "Default Zone, Event." One of those record has the following header.
ID: 975f5715-3ccd-4c5f...
Created:Jan 20 2015 19:00 Created By: _ac6625... Modified: Modified By:
My Question is as following:
1) What do I put in the "Reference" Field of the EventRef0? The Event ID, which I currently have, or something else?
2) Is this is correct way to create multiple References, that is by creating 3 references for 3 Events that I want to reference?
3) When I want to fetch the Events, can I fetch all the CKReferences in one call to an array, and then fetch the Event data indexing that array, or do I have to make separate calls to get each event? I was hoping there is a way to get all the references in an array by keying on the "Reference" attribute. Not sure if that's possible. Preferably is Swift please.
Any help would be greatly appreciated. Thanks.
If you have a 'data' recordType what will have a reference to multiple 'event' recordType objects, then you should add a CKReference in the 'event' recordType where the CKReference points to the 'data' object. So the data object does not need to have a CKReference to the 'event' object. You can get all the event objects by querying the CKReference field for the id of the 'data' object.
Just query your 'events' recordType with a predicate like this:
CKReference* recordToMatch = [[CKReference alloc] initWithRecordID:dataID action:CKReferenceActionNone];
NSPredicate* predicate = [NSPredicate predicateWithFormat:#"dataID == %#", recordToMatch];

Create record in related table *only* if not previously existing there

I have a Filemaker database with a Members table, an Events table, and a join table called Attendance which should list which members attended which events. Attendance has the setting "allow creation of new records" ticked for Members (doesn't need it for Events).
Data arrives in an Excel spreadsheet for importing to Attendance. But then I want to see if there are people attending who aren't in our records already... sort of like this:
look at each of the newly added records in the attendance table
see if the members mentioned there exist in the member table
if so, do nothing
else create a new record in the member table for them, using data from the attendance table.
If I'm understanding it correctly, Steps 3 and 4 should look something like this:
Set Variable [ $fname; Value: Attendance::firstname ]
Go To Layout ["Member" (Firstname)]
New Record/Request
Set Field [Member::Firstname; $fname]
i.e. put the desired info into variables, start a new record in the related table and set the data there to the value of the variables.
But how do I get step 2 happening? I'm guessing some sort of loop will go through the found set of records in Attendance, and grab the relevant identifier. How do I show that to the Member table to see if it's present or not?
"Firstname" might be a bit light to pinpoint a unique member, if you have many members !
I'd presume therefore you would have some sort of unique key for each member.
As from there, just search for the member in the member base, before creating the new record…
Link the two tables with an EQUALS relationship.
Write a script:
// Loop through your attendance records.
// Be sure you're in the correct layout
Go to Layout ["imported list"]
// Attempt to go to the membership record of the person who is attending the event.
Go to Related Record [Show only records from: from table: "membership table"; using layout: "membership table"
// If the person who is attending IS in the membership list, you'll go to that member's record in the "membership table."
// If the person who is attending is NOT in the membership list, you'll get an error. You can use that error in an if statement to execute code to add that member.
If [Get ( LastError ) = "101"]
// insert code to add new member
End if
Since you already have a relationship between Member and Attendance, it means that you can "see" any related Members from the Attendance table across the relationship.
We also know that you only need to evaluate the new attendance records coming in from your spreadsheet.
I also assume that there could possibly be be more than one attendance record per Member in the spreadsheet. This may not be the case, but it's safer to assume it's possible.
I'm also assuming that you are linking the Member table to the Attendance table via the primary key in Members and a foreign key in Attendance, i.e. Member::ID = Attendance::Member ID.
So here's the script process I suggest:
Import the new Attendance record into the Attendance table.
This will give you a found set of only new attendance records
From the Attendance layout, perform a find for related Member records with an omit, i.e.:
# This assumes you're already on the Attendance layout
Enter Find Mode
Set field [Member::ID ; "*"]
Omit record
Constrain Find
This will give you a found set of new Attendance records that do not have matching Member records.
From here you could loop through each of the attendance records and create the Member records as needed.
If you check the Allow creation on the Member side of the Member -< Attendance relationship, you could set the field in the Member table directly from the Attendance layout.
Since the 1 to Many relationship between Member and Attendance goes 1=Member Many=Attendance, you would need to check to be sure you haven't already created a Member record during your loop, i.e. If a new Member had multiple Attendance records you could have already created a Member record during the loop.
Your loop would look like this:
Go to Record [First]
Loop
If [IsEmpty(Member::ID)]
Set Field [Member::First Name] // This first Set Field will create your new Member Record as long as the "Allow Creation" is enabled on the Member side
Set Field [Member::Last Name]
... This would be the rest of your set field steps for Member
End If
Go to Record [Next ; Exit After Last]
End Loop
This way you don't need to navigate away from your Attendance record set. Also, the Primary and Foreign keys for both tables will be created and set automatically through the attributes of the relationship itself.

CakePHP - Automatically populate form fields from model

I thought the form helper did this already, but can the fields in my form automatically be populated with values from the model or do I have to set them all as template variables and set them all as the value of each field manually?
The form is for a user profile, so I just want it to put the user's names, email, etc in the correct form fields automatically.
for example: in controller $this->data = $this->Model->find('first',array(...));
in view:
$this->Form->create('Model');
$this->Form->input('field1');
...
$this->Form->end('Save');