Add custom fields to a data subset

Certified Associate Developer

Hello Everyone I am practicing Appian I have a case where I am fetching data from database using expression rule now I want to add a custom field to each record that is returned with the data subset 

please Notice that this field doesn't exist on the table how can I accomplish this check the below example to better understand my question 

Let us say I have a table called students that has the following columns id, name and age when I perform a query it will fetch these columns I want it to retrieve extra custom column that doesn't exist in any other table lets say I want to add a column called rank with a custom value either hard-coded or passed as a parameter 

Thanks in advance

  Discussion posts and replies are publicly visible

Parents
  • It is not a very good approach or practice to do that, because any change that you would do on the CDT would not be reflected on your expression rule. It would be much better to add those custom fields on the CDT. In general, what you are suggesting is not a good practice.

    Anyways, the solution from would solve your problem.You don't need though to create a second CDT to cast, you can directly provide the structure.

    this would give you a dictionary with the structure with id, name and ranking (always 2)

    load(
    
    local!student: rule!APP_QE_getStudent(id:null).data,
    
    {
    
    a!forEach(
    
    items: local!student,
    
    expression{
    
    id: fv!item.id,
    
    name: fv!item.name,
    
    ranking: 2
    
    
    }
    
    
    )
    
    
    }
    
    
    )
    
    
    

Reply
  • It is not a very good approach or practice to do that, because any change that you would do on the CDT would not be reflected on your expression rule. It would be much better to add those custom fields on the CDT. In general, what you are suggesting is not a good practice.

    Anyways, the solution from would solve your problem.You don't need though to create a second CDT to cast, you can directly provide the structure.

    this would give you a dictionary with the structure with id, name and ranking (always 2)

    load(
    
    local!student: rule!APP_QE_getStudent(id:null).data,
    
    {
    
    a!forEach(
    
    items: local!student,
    
    expression{
    
    id: fv!item.id,
    
    name: fv!item.name,
    
    ranking: 2
    
    
    }
    
    
    )
    
    
    }
    
    
    )
    
    
    

Children
No Data