Forums

fields to retrieve {data:text1} does not work how to do it

samir1903 13 Mar, 2019
i need to retrevie fileld name as variable

example
.......tables&act=chart&table_name=os5pk_chronoforms_data_fffff&field=text1

here i can take field name as a variable

with this i want to serach things with dropdown selection
lets say

marketing has 1 to 4 values
accounting has 1 to 4 values
wheen i select marketing from dropdown i can list only marketing course
so marketing column to retreive in database
healyhatman 13 Mar, 2019
In your case it would be {data:field}
samir1903 14 Mar, 2019
Field name is text1
{data:text1} gives error when put fields to retriew
healyhatman 14 Mar, 2019
.......tables&act=chart&table_name=os5pk_chronoforms_data_fffff&field=text1
In THAT case that you posted, to get the value of "field" you would use {data:field}
samir1903 14 Mar, 2019
no this is an example i saw on chronoforms when you click chart icon on tables
it show istatistics based on selected field name
i mean it looks like doable

i just want to know how to do this
healyhatman 14 Mar, 2019
In WHERE conditions:
databasefieldname:{data:formfieldname}/-
NOT in "fields to retrieve".

The /- at the end means "if formfieldname doesn't exist, ignore the condition and move on"
samir1903 14 Mar, 2019
in your way it returns values of text1

But this is not what i want
i want this
lets say text1 is a dropdown inside value a and b
table
a b
4 5
2 4
2 5

select {data:text1}, count({data:text1} from table x group by {data:text1}

i mean i want field name as variable not the value

if user select a group a column
if user select b group b column
healyhatman 14 Mar, 2019
Sorry don't think it works that way. Just retrieve all the fields the performance hit is negligible.
To pick a particular field out of the returned array you'll need to use PHP, something along the lines of (for "return first matching")
$this->get("read_data#.model." . $this->data("field"))
This topic is locked and no more replies can be posted.