Skip to content

Instantly share code, notes, and snippets.

@Chetan496
Last active September 27, 2016 17:40
Show Gist options
  • Save Chetan496/6fe41895db6a5b0b00561120e03ddf5f to your computer and use it in GitHub Desktop.
Save Chetan496/6fe41895db6a5b0b00561120e03ddf5f to your computer and use it in GitHub Desktop.
This SAIL interface transposes the data in a paging grid
load(
local!pagingInfo: a!pagingInfo(
startIndex:1,
batchSize:-1
),
with(
local!data: {
type!AB_AppInfo(Name: "Ap1", Description: "App 1"),
type!AB_AppInfo(Name: "Ap2", Description: "App 2")
},
local!transposed: fn!merge(
fn!index(local!data, "Name", {}),
fn!index(local!data, "Description", {})
),
local!fieldNames: {
"Name",
"Description"
},
/*a!paragraphField(
value: local!transposed
)*/
a!gridField(
value: local!pagingInfo,
saveInto: local!pagingInfo,
totalCount: 4,
columns: {
a!gridTextColumn(
data: local!fieldNames,
alignment: "LEFT"
),
a!gridTextColumn(
data: local!transposed[1]
),
a!gridTextColumn(
data: local!transposed[2]
)
}
)
)
)
@Chetan496
Copy link
Author

Yet another approach:

load(

local!pagingInfo: a!pagingInfo(
startIndex:1,
batchSize:-1
),

with(

local!data: {
  type!AB_AppInfo(Name: "Ap1", Description: "App 1"),
  type!AB_AppInfo(Name: "Ap2", Description: "App 2")
},

local!transposed: fn!merge(
  fn!index(local!data, "Name", {}),
  fn!index(local!data, "Description", {})
),

local!fieldNames: {
  "Name",
  "Description"
},

/*a!paragraphField(
  value: local!transposed
)*/

a!gridField(
  value: local!pagingInfo,
  saveInto: local!pagingInfo,
  totalCount: 4,
  columns: {

    a!gridTextColumn(
      data:   fn!apply(fn!concat(_,": ", _), fn!merge(local!fieldNames, fn!cast(103, local!transposed[1]))) 
    ),

    a!gridTextColumn(
      data: local!transposed[2]  
    )
  }

)

)

)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment