CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 SOLVED - Display result from a function in grid's label

Print topic Send  topic

Author Message
ijtzib

Posts: 24
Posted: 06/28/2012, 1:23 PM

Hi,

I have a grid of dates fields and a function that calculates the date difference. So How can I display the results in a label for each row....??

The results should output the number of days...
return $days;

Hmmm....This must be easy but Im a neewbie in CCS and Programming.

Does it have to do with this code below in the Before Show Row of the grid?
$Container->Label1->SetValue();

Can someone point me to the rite way of doing this?

Thank you very much

View profile  Send private message
ab5ni


Posts: 177
Posted: 06/29/2012, 2:14 PM

That is correct. Just add a label, and on the "Before Show Row" event, do $Container->Label1->SetValue() to the value u specify.

Regards,


_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
ijtzib

Posts: 24
Posted: 07/03/2012, 9:28 AM

Hi ab5ni,

Thank You for your response... Just to make things clear & it seems Im not getting to display the results yet...

Here is what I have...

This is my function:

function dateDiffExcludeWeekends($startDate, $endDate, $half) {
// Sets the Count
$count = 0;
$startStt = strtotime($startDate);
$endStt = strtotime($endDate);
if($half){
$count-=0.5;
}
// iterates through each day till the end day is back at the start date
while (date("Y-m-d", $startStt) <= date("Y-m-d",$endStt)){
$count = (date("w", $endStt) != 0 && date("w", $endStt) != 6) ? $count +1 : $count;
$endStt = $endStt - 86400;
}
return $count;
}

----------------------------

This calculates the number of days between to dates minus half day excluding weekends. I Know the function is working if I plugged in values and do an echo dateDiffExcludeWeekends(); It display result...

I then created a label1 and in the Before Show Row of the form i plugged in $Container->Label1->SetValue($dateDiffExculdeWeekends);

And it doesn't work..

What am I doing wrong?

Ijtzib
View profile  Send private message
bannedone


Posts: 273
Posted: 07/03/2012, 9:33 AM

$Container->Label1->SetValue(dateDiffExculdeWeekends($paramOne,$paramTwo,$paramThree));

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
ijtzib

Posts: 24
Posted: 07/03/2012, 10:07 AM

Hi Bannedone,

I Plugged in

$test_prefixvacationleave->Vac_Total_Days->SetValue(dateDiffExcludeWeekends($paramOne,$paramTwo,$paramThree));

in the Before Show Row of the test_prefixvacationleave grid but I get 1 in each row as the result..... Anything else I have to check...?Am I missing something else guys?? the Label name is
Vac_Total_Days

Thanks
ijtzib
View profile  Send private message
bannedone


Posts: 273
Posted: 07/03/2012, 10:20 AM

$Container->Vac_Total_Days->SetValue(dateDiffExculdeWeekends($paramOne,$paramTwo,$paramThree));

You need to suppy the correct dates and values for all parameters to the function
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
bannedone


Posts: 273
Posted: 07/03/2012, 10:32 AM

BTW

http://forums.yessoftware.com/posts.php?post_id=118602

Let me know if this is still valid.

Thanks

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
ijtzib

Posts: 24
Posted: 07/03/2012, 3:30 PM

I sent You a PM...

Quote :
BTW http://forums.yessoftware.com/posts.php?post_id=118602 Let me know if this is still valid. Thanks


View profile  Send private message
ijtzib

Posts: 24
Posted: 07/04/2012, 10:54 AM

Ok I plugged in this but still error....

$Container->Vac_Total_Days->SetValue(dateDiffExcludeWeekends($Container->startDate->GetValue(), $Container->endDate->GetValue(), $Container->half->GetValue()));

Im getting an error message...

Warning: strtotime() expects parameter 1 to be string, array given in...

Am i doing it right...??

Thanks
ijtzib
View profile  Send private message
bannedone


Posts: 273
Posted: 07/04/2012, 12:21 PM

You are sending the dates as arrays to your function.

CCS stores dates as arrays in the controls.

Try GetText() method

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
ijtzib

Posts: 24
Posted: 07/04/2012, 1:06 PM

Hi bannedone,

Thank you so much for your replies... Works Now!!

:-)
View profile  Send private message
ijtzib

Posts: 24
Posted: 07/20/2012, 11:57 AM

Hi Guys,

Again,....Although I have marked the topic solved but thought it could be a continuation to this topic.

Now that the calculated value is displayed on a label on the grid for all rows, Now I want to sum up the total of all rows and display on a label also on the grid below...

Its the same concept here...
http://forums.yessoftware.com/posts.php?post_id=118694

But now is not a field on the database is a calculate value in a label...

Can anyone point me how to go about accomplishing this....??

Thank you guys for your kind responses....

ijtzib

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.