Zend GData Spreadsheets Add Column Name - zend-framework

Been hunting google, the google docs and the zend docs for this but without much success. I'm trying to add data to a Google spreadsheet using the API and Zend GData. I've succesfully grabbed my spreadsheet and worksheet keys and can update the existing rows without problem.
In short the project requires me to add further column for the previous months data and this is were my problem starts. I can update the existing data for each row OK but when I try to add a new "column" to the spreadsheet nothing happens. The existing data is updated for the new information does not get inserted.
My code at present is as follows (assuming I already have the spreadsheet and worksheet key):
$query = new Zend_Gdata_Spreadsheets_ListQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$query->setWorksheetId($worksheetId);
$listFeed = $spreadsheet->getListFeed($query);
//$rowData = $listFeed->entries;
foreach ($listFeed as $listEntry) {
$rowData = $listEntry->getCustom();
$newRow = array();
//Populate the row data
foreach($rowData as $field) {
$newRow[$field->getColumnName()] = $field->getText();
}
//Add an array key for the new column
$newRow['aug2011'] = 'Some data here';
$spreadsheet->updateRow($listEntry, $newRow)
}
exit();
This is beginning to drive me potty with a lack of documentation so any pointers would be greatly received!

Related

Displaying Records with route53 using .net

Before I begin I do want to mention this is my first time doing this so forgive any errors I might do. I am currently learning how to use route53 using .net and I am currently stuck on getting it to post records in a field. I have the correct Accesskey,Secretkey and hostedzone id.
iv tested pulling up the name of the hosted zone aswell as getting it to display the number of records. but when i try to get it to actually post the values it displays: "Amazon.Route53.Model.ListResourceRecordSetsResponse". I'm sure the answer is right there in front of me but in the API for route53 there isnt really any guidelines to showing records. it shows you how to create records but not simply viewing them.
Here is what I have:
route53Client.ListResourceRecordSets(new ListResourceRecordSetsRequest
{
HostedZoneId = "HostedZoneId here",
MaxItems = "1"
});
I'm assuming that I am not including enough information for it to properly pull the records. I can pull them up through the AWS CLI so I know I have what i need to see them. just stuck on this part. any help would be great.
Here is the link to the API: https://docs.aws.amazon.com/sdkfornet/v3/apidocs/index.html
Process ListResourceRecordSetResponse like this:
var result = client.ListResourceRecordSets(
{
HostedZoneId = "HostedZoneId here",
MaxItems = "1"
});
foreach (var recordSet in result.ListResourceRecordSetsResult.ResourceRecordSets)
{
// ResourceRecordSet
foreach(var resourceRecord in recordSet.ResourceRecords)
{
// ResourceRecord
Console.WriteLine(resourceRecord.Value);
}
}
ListResourceRecordSetsResponse
ResourceRecordSet
ResourceRecord

How to fetch multiple records from filemaker pro

table contain 1304 records but after running the script given below it shows only the last record 1304 times. so please help me.is it possible to fetch multiple records from filemaker,i dont have any idea.
<?php include ("dbaccess.php");?>
<?php
//Create the 'find all' command and specify the layout
$findCommand = $fm->newFindAllCommand('eventsROY');
//Perform the find and store the result
$result = $findCommand->execute();
//Check for an error
if (FileMaker::isError($result)) {
echo "<p>Error: " . $result->getMessage() . "</p>";
exit;
}
//Store the matching records
$records = $result->getRecords();
//print_r($records);
echo $cnt = count($records);
foreach($records as $rc){
$time = $rc->getField('time');echo "<pre>";
print_r($time);
echo "<pre>";
}
?>
This question is super old so I'm not sure if it's still an issue, but if it is maybe I can help.
What do the fields look like on your layout eventsROY layout? More importantly, are they all coming from the layout's native Table Occurrence or are some of them, time specifically, coming from a different related table?
Your structure is correct. I cleaned it up a little here:
<?php
include ("dbaccess.php");
//Create the 'find all' command and specify the layout
$findCommand = $fm->newFindAllCommand('eventsROY');
//Perform the find and store the result
$result = $findCommand->execute();
//Check for an error
if (FileMaker::isError($result)) {
echo "<p>Error: " . $result->getMessage() . "</p>";
exit;
}
//Store the matching records
echo $count = $result->getFetchCount();
foreach($result->getRecords() as $record){
$time = $record->getField('time');
echo "<pre>";
print_r($time);
echo "<pre>";
}
?>
So, if you're getting the record count you expect from the eventsROY table, it means that the query is working and if you're getting a value (even if it's wrong) from the time field it means that field is available on the eventsROY layout.
The way I could see this pulling the same time value over and over is if time is a field from a related table and the relationship for that related table using the same related record for every record in your eventsROY table. For example, if you had a table called schedule that was related to the eventsROY table by a cartesian join (X) then when you look at the schedule::time field from any eventsROY record the value would be the same because it's using the first related record from the schedule table to show the value.
What you should do to troubleshoot this is:
Go to your eventsROY layout in FileMaker and see if the time field is coming from the eventsROYtable or a different related table
If it is coming from the eventsROY table and is a calculation, make sure the calculation is being Evaluated from the eventsROY table occurrence (if it's being evaluated from a different TO that could cause an issue too)
Back in your php, try using a print_r($record) in place of your print_r($time) just to make sure that the rest of your fields are also returning the expected response

how to merge rows in a table in powerpoint using win32:OLE in perl

i am able to add a new table on the slide using Win32:OLE in perl...but i am looking into merge a couple of rows in the table....can anyone provide any tips on that.
OR it would also help if i could get any help on how to insert data into an existing table on the Slide, i.e. how to read the table object of the Existing table in the powerpoint file.
my $Slide = $Presentation->Slides->Add({Index=>$value , Layout=>ppLayoutText});
$Slide->{Name} = "Slide1343121";
my $Title = $Slide->Shapes->{Title};
$Title->TextFrame->TextRange->{Text} ="Title";
$Title->TextFrame->TextRange->Font->{Size} = "32";
my $table = $Slide->Shapes->AddTable( "5, 6, 1, 115);`
can anyone help me upgrade my code with the functionalities i am looking for..?
Well, I have never used Perl with PowerPoint but I thinks its just regular COM access.
In VBA you merge cells and change their text like this
tableShape.Table.Cell(1, 1).Merge table.Cell(1, 2) ' Merge first and second cell
tableShape.Table.Cell(1, 1).Shape.TextFrame.TextRange.Text = "Text"
So I guess in Perl it looks more or less like this, no?
$table->Table->Cell(1, 1)->Merge( $table->Table->Cell(1, 2) );
$table->Table->Cell(1, 1)->Shape->TextFrame->TextRange->{Text} = "Text";

wordpress 3.2.1 database query

i am trying to make a simple selection in a wordpress table (created by a plugin). the table is named reduceri , and has the following columns: id, post, category.
so, i am trying to take all the category values, when the post is equal to the current post id.
the way i am doing the query is:
$the_query = "
SELECT $wpdb->reduceri.category
FROM $wpdb->reduceri
WHERE $wpdb->reduceri.post = ".$post_id."
";
$my_reduceri = $wpdb->get_results($the_query);
but when i var_dump the $my_reduceri all i get is an empty array: array(0) { } even though there should actually be some results... any idea where i am wrong (in the query)?
thank you
Did you declared global $wpdb; before using this query?

Zend GData Spreadsheet WorksheetID

What is the $worksheetId from the Zend GData documentation supposed to be?
http://framework.zend.com/manual/en/zend.gdata.spreadsheets.html
$query = new Zend_Gdata_Spreadsheets_ListQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$query->setWorksheetId($worksheetId);
$query->setSpreadsheetQuery('name=John and age>25');
$listFeed = $spreadsheetService->getListFeed($query);
The documentation uses that $worksheetId several times, but I can't seem to see where to get that from a spreadsheet.
If you don't know the worksheet identifiers, you have to perform a first query to retrieve the worksheets metafeed for your spreadsheet:
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$feed = $spreadsheetService->getWorksheetFeed($query);
Then, you iterate $feed->entries and each entry will represent a worksheet and have an identifier.
The $worksheetId is the worksheet identifier.
Worksheets have a gid identifier (1,2,....) that you can see directly in the url of the document when is opened.
Unfortunately you can't access to them through API with that id.
Use instead the codes that you find in the following discussion:
Worksheet GIDs