app42 api integration

0 votes

hello, i am new in using app42 api, and i have integrated it with my web app and i have ran into a few problems

1. how do i sum a column in the inner array of a collection

    foreach( $jsonDocList as $key=>$jsonDoc ) 

  {
  $products = json_decode($jsonDoc->getJsonDoc());
  $jsonDocList[$key] = $products;
 
  }
2. how do i get the hour part of the created at timestamp
 
asked Jul 3, 2015 in App42 Cloud API-BaaS by gnderi (10 points)

1 Answer

0 votes

Hello,

 

Apologies for getting late back to you. Kinldy find my answer inline for your query:

1. To sum of a column in the inner array of collection:

foreach( $jsonDocList as $key=>$jsonDoc ) 
{
     $products = json_decode($jsonDoc->getJsonDoc());
      
     foreach( $products as $products_key=>$products_value ) 
     {
         $sum+=$products_value;
     }
}

 

2. Get the hour part of the created at timestamp

 

 

$timestamp="2009-05-06 15:07:56";

 

$hours = date('H', strtotime($timestamp));

 

Let me know if it helps.

 

Regards,

Himanshu Sharma

answered Jul 6, 2015 by hs00105 (2,005 points)
thanks for your reply, iam trying, i will let you know
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...