Custom Caption based on SQL Query

QuestionsCustom Caption based on SQL Query
Mike Sheppard asked 1 year ago

I would like to be able to create a custom caption based on an SQL Query, such as “Select MAX DATE from Table”, then put that date in the caption. I have a few reports that are built on static-data, so it would be nice to know the most recent date from the report for the caption.

I have tried a few different tricks, but nothing works and I don’t see anything in the Demos or on the help-site.

Any thoughts would be appreciated.

Thanks

 

Mike

5 Answers
Mike Sheppard answered 1 year ago

Ticket can be closed – I was not setting the variables correctly, this works perfectly fine if you run an ODBC_EXEC, then fetch the array and set the variable.

Thanks

 

Mike

Abu Ghufran Staff answered 1 year ago

Thanks for updating.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Max answered 1 year ago

how did yo accomplish that ?

Abu Ghufran Staff answered 1 year ago

You can run a query to get your value from database. Here $g is jqgrid object.

$rs = $g->get_one(“SELECT field from tab limit 1”);
$cap = $rs[“field”];

$opt[“caption”] = $cap;

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Max answered 1 year ago

does not seems to work, print_r($rs); there is nothing in rs varible.. $rs = $g->get_one(\”SELECT updated from markup limit 1\”); $cap = $rs[\”updated\”];

Abu Ghufran Staff replied 1 year ago

Please share complete code for review. You can paste code on gist and share link here.
https://gist.github.com/

Your Answer

10 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?