Skip to main content

Dears,

Can someone guide me what I need to write exactly to hide few fields in Mobile based on access group. For web client I have done it for mobile how it can be done?

Below is my mobile script to hide the fields let me know anything I am missing in the script.

Requirement

In mobile I am trying to hide user_def16 and user_def17 from part_usage table and bin_id from stock_bin table based on the access group (which is ‘ELUX_US’) .

 

 

var taskId = getCurrentKeys("task", "task_id");
var partUsage=getCurrentKeys
var binID=getCurrentKeys
var AccessGroup = getDBValue(stringFormat("SELECT access_group FROM task WHERE task_id = {0}");
if (AccessGroup == 'ELUX_US') 
{    
    setControlVisibility('part_usage','user_def16',true);
    setControlVisibility('part_usage','user_def17',true);
    setControlVisibility('stock_bin','bin_id',true);    
}           
else
{
    setControlVisibility('part_usage','user_def16',false);
    setControlVisibility('part_usage','user_def17',false);
    setControlVisibility('stock_bin','bin_id',false);
    
}

 

 

 

 

Hi @Pinmaya Kumar Singh 

  • What is the value you get for AccessGroup ?
    • Try adding alert(AccessGroup); to see the value.
  • Your query should be all lower case letters. SQLite is case sensetive.
  • You can also try running your query on the mobile DB. Are you getting results?

Also, not sure if this is a typo but you are missing parameters in the function getCurrentKeys in the second and third lines.

 

Cheers!


@Pinmaya Kumar Singh apart from the above comment feedback you also need to use the correct syntax for the StringFormat function.

It needs to be corrected as following, otherwise query result will be null

 

 

var AccessGroup = getDBValue(stringFormat("SELECT access_group FROM task WHERE task_id = {0}",taskId));

 


Reply