Load units value from database

Hi,
I want to load units value from database, actually the values are from two table so i need JOIN query for retrieval. How can i implement this? Please reply asap.

Thanks in advance
Shiju

Hi,
I have retrieved the values from database but i have to implement my own custom join queries. Now am getting values with

$list_operatory = new OptionsConnector($res);
$list_operatory->render_table(“facility_operatory”,“opr_id”,“opr_id(value),opr_name(label)”);
$scheduler->set_options(“operatory”, $list_operatory);

Instead this i have to implement my query to retrieve values, now with above code is retrieving whole data from database without “WHERE” clause and JOINS. How can i implement my query?

I have retrieved the values with my query but actually i don’t know how can i display the values as label.

Here am attaching my code snippet, please have a look and let me know whats my mistake.

Server side

$list_operatory->render_sql($SQL,“opr_id”,“opr_id(key),opr_name(label)”, “”, “”);
$scheduler->set_options(“operatory”, $list_operatory);

Client Side

scheduler.createUnitsView({
name:“operatory”,
property:“apmt_operatory_id”,
list:scheduler.serverList(“operatory”),
size:5,
step:5
});

Thanks in advance
Shiju

you can use

$list_operatory->render_sql("SELECT * FROM some","opr_id","opr_id(value),opr_name(label)");

any kind of SQL code can be used as the first parameter, including the joined tables

Are you using fixed js file from the
viewtopic.php?f=6&t=12647&start=30
?

$list_operatory->render_sql($SQL,"opr_id","opr_id(key),opr_name(label)", "", "");

it must be

$list_operatory->render_sql($SQL,"opr_id","opr_id(value),opr_name(label)", "", "");

Hi,

FYI i am loading values not for select box instead for units.

I am getting this error

Error: D[F] is undefined
Source File: localhost/PureChart/Scheduler/co … r_units.js
Line: 1

I have changed the code in the server side as you said but its not loading the datas. Is there any error with client side code.

I am attaching my

client side code

scheduler.createUnitsView({
name:“operatory”,
property:“apmt_operatory_id”,
list:scheduler.serverList(“operatory”),
size:5,
step:5
});

Server side code

$list_operatory = new OptionsConnector($res);
$list_operatory->render_sql($SQL,“opr_id”,“opr_id(value),opr_name(label)”, “”, “”);
$scheduler->set_options(“operatory”, $list_operatory);

Please have a look on my code and let me know whats my mistake.

Thanks in advance.
Shiju

Getting script error

Error: D[F] is undefined
Source File: codebase/ext/dhtmlxscheduler_units.js
Line: 1

I am getting this error while clicking on my units.

Script error can occurs if you are using empty options collection for the unit view.

Your code, from previous post, looks correctly and has not any visible problems.
You can try to compare problematic code with
samples\03_extensions\17_connector_units.html
which is shows the same use-case.

HI,

Its working fine when i am using render_table()
$list->render_table(“tbl_name”,“id”,“id(value),name(label)”);

But when am using render_sql() its not working.

$SQL = “SELECT fields FROM tbl_name WHERE field =”.$id." AND deleted = 0 ";
$list->render_sql($SQL,“id”,“id(value),name(label)”, “”, “”);

Please have a detail look into my code snippet and let me know what the problem?

Please reply asap.

Thanks in advance
Shiju

$SQL = “SELECT fields FROM tbl_name WHERE field =”.$id." AND deleted = 0 ";

Is this the exactly same SQL as is used in your case?
It doesn’t selects id and name fields, which mentioned in render command - so it will not produce any meaningfull output.

Query what am running

SELECT opr_id,opr_name FROM table_name WHERE opr_fac_id =$fac_id AND opr_deleted = 0

Try to change it as

[code]$sql = “SELECT opr_id as value,opr_name as label FROM table_name WHERE opr_fac_id =$fac_id AND opr_deleted = 0”;

$list_operatory->render_sql($SQL,“opr_id”,“opr_id(value),opr_name(label)”, “”, “”);[/code]

Hi,
That query generates

Error type: LoadXML
Description: Incorrect XML

Wow Thanks Stanislav

We got it worked perfectly.

Great work, Thanks again.

Shiju

hello

i have tested it , but it doesn"t work

can you help me ?

In fact it’s wotk but the field is empty and i have no WHERE clause it just a select *

Ok sorry for spamming but it’s work

$listcampus->render_sql(“SELECT name as value , name as label FROM campus”,"",“name(value),name(label)”);
$scheduler->set_options(“fk_campus”, $listcampus);

here is my solution