cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Is it possible to highlight complete column based on column name?

Janakiraman-P
15-Moonstone

Is it possible to highlight complete column based on column name?

Hi,

 

Am displaying a grid with 24 hrs data, want to highlight columns based on user selection. Selection happening by range slider.

 

Ex,

User can select  From and To hours b/w 1-24 by range slider, based on the selection grid columns should be highlighted. Grid column name are like 1,2,3,..24

 

 

Regarding

Janakiraman P

ACCEPTED SOLUTION

Accepted Solutions
Radu
15-Moonstone
(To:Janakiraman-P)

Hi,

 

You did not use the x variable in the for loop. I assume it is the row index for the infotable. What is the datashape of alldata? Does it contain all 48 columns? If so, try accessing the elements through alldata[x][colArray[index-1]].

 

Also if you are working with booleans, you shouldn't enclose true between apostrophes.

View solution in original post

4 REPLIES 4
Radu
15-Moonstone
(To:Janakiraman-P)

Hi,

 

I don't believe it is possible to colour specific cells within a row, only the whole row itself.

You might consider a service that filters the grid columns in such a way that the only columns shown are the ones specified in the range slider. Is this approach good for your solution?

Janakiraman-P
15-Moonstone
(To:Radu)

Hi,

 

Am having an idea to make it possible.

 

I have 48 columns in the datashape, first 24 are actual columns and next 24 are duplicate of first.

Ex, one,two,three...twentyfour     then  one_1,two_2,three_3...twentyfour_24

 

based on value of one_1(true/false) state definition can be applied on column one.

 

Based on the user input range am writing the following code to update the infotable.

 

user input variables are, from=2  to=5

 


var alldata = Things["R_n_D_John"].GetDataTableEntries({
maxItems: undefined /* NUMBER */
});
var colArray=['one_1','two_2','three_3','four_4','five_5','six_6','seven_7','eight-8','nine_9','ten_10','eleven_11','twelve_12','thirteen_13','fourteen_14','fifteen_15','sixteen_16','seventeen_17','eighteen_18','nineteen_19','twenty_20','twentyone_21','twentytwo_22','twentythree_23','twentyfour_24'];

 

 

for(var x=0;x<alldata.getRowCount();x++){
for(var index=from;index<=to;index++)
{
alldata.colArray[index-1]='true';
}


}

result=alldata;

 

 

 

but am getting a different error now. getting the following error.

 

 

Error executing service filteredData. Message :: TypeError: Cannot set property "1" of undefined to "true" - See Script Error Log for more details.

 

help me to resolve the error if possible.

 

 

Regards,

Janakiraman P

 

Radu
15-Moonstone
(To:Janakiraman-P)

Hi,

 

You did not use the x variable in the for loop. I assume it is the row index for the infotable. What is the datashape of alldata? Does it contain all 48 columns? If so, try accessing the elements through alldata[x][colArray[index-1]].

 

Also if you are working with booleans, you shouldn't enclose true between apostrophes.

Janakiraman-P
15-Moonstone
(To:Radu)

Hi @Radu ,

 

Thanks for your suggestion, it is working now.

 

What is the datashape of alldata?

           alldata is a datatable result which contains all the columns.

Does it contain all 48 columns?

           yes

Also if you are working with booleans, you shouldn't enclose true between apostrophes

    Its string only, and Thingworx can understand boolean in 'true'/'false' 0/1 true/false. 

 

Announcements


Top Tags