To use recordtype within an editable grid

Certified Associate Developer

Hi everyone!

I´m doing an interface using Recordtypes from scrach. I´m making a grid in a form to sum some quantities from de employers. I´m having some problems with the dynamic link to add new rows of employeers expenses and also having problems to summarize the fields with the quantities. I´m providing part of the code. Could you tell me what i´m doing wrong please? Thanks a million in advance!

a!sectionLayout(
label: "Gastos",
contents: {
a!gridLayout(
totalCount: count(local!articulos),
headerCells: {
a!gridLayoutHeaderCell(label: "Fecha del Gasto"),
a!gridLayoutHeaderCell(label: "Descripción"),
a!gridLayoutHeaderCell(label: "Tipo de Gasto"),
a!gridLayoutHeaderCell(label: "Importe del Gasto"),
/* For the "Remove" column */
a!gridLayoutHeaderCell(label: "")
},
/* Only needed when some columns need to be narrow */
columnConfigs: {
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1),
a!gridLayoutColumnConfig(width: "ICON")
},
rows: a!forEach(
items: local!articulos,
expression: a!gridRowLayout(
id: fv!index,
contents: {
a!dateField(
label: "Fecha del Gasto",
value: fv!item['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{ee90ea10-de44-412a-a7fc-ed486676ab48}fechaExactaDelGasto'],
saveInto: fv!item['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{ee90ea10-de44-412a-a7fc-ed486676ab48}fechaExactaDelGasto'],
required: true,
validations: if(
todate(
ri!gasto['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{ee90ea10-de44-412a-a7fc-ed486676ab48}fechaExactaDelGasto']
) > todate(
ri!gasto['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{22fe26e4-88f2-4947-813e-3c55bac6776d}fechaFinGastos']
),
"La fecha del gasto
no puede ser posterior a la del fin.",
null
),
align: "LEFT"
),
a!textField(
label: "Descripcion",
value: fv!item['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{caa7a4a2-254c-4960-b905-2c96aa0de370}descripcion'],
saveInto: fv!item['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{caa7a4a2-254c-4960-b905-2c96aa0de370}descripcion'],
characterLimit: 400,
required: false
),
a!dropdownField(
label: "Tipo De Gasto",
placeholder: "-- Seleccione uno -- ",
choiceLabels: {
"Comidas",
"Hoteles",
"Alquiler de coches",
"Material de oficina",
"Otros"
},
choiceValues: {
"Comidas",
"Hoteles",
"Alquiler de coches",
"Material de oficina",
"Otros"
},
value: fv!item['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{fc180f19-2489-460b-895e-fa7f3bb8b83f}tipoDeGasto'],
saveInto: fv!item['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{fc180f19-2489-460b-895e-fa7f3bb8b83f}tipoDeGasto'],
required: true
),
a!integerField(
label: "Importe Del Gasto",
value: fv!item['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{014bca36-cff6-4b6f-87e1-739188a57a1b}importeDelGasto'],
saveInto: fv!item['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{014bca36-cff6-4b6f-87e1-739188a57a1b}importeDelGasto'],
required: true
),
a!richTextDisplayField(
value: a!richTextIcon(
icon: "close",
/*altText: "delete " & fv!index,*/
/*caption: "Remove " & fv!item.name & " " & fv!item.lastName,*/
link: a!dynamicLink(
value: fv!index,
saveInto: {
a!save(
local!articulos,
remove(local!articulos, save!value)
)
}
),
linkStyle: "STANDALONE",
color: "NEGATIVE"
)
)
}
)
),
addRowlink: a!dynamicLink(
label: "Añadir otro Gasto",
value: 'recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto'.,
saveInto: {
/*a!save(fv!item.importeDelGasto, append(local!employees, save!value))*/
/*ri!gasto['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.actions.{8806062f-3f30-414b-b36c-b60010166943}newGasto']*/
a!save(ri!gasto, append(ri!gasto, save!value ))
}
),
rowHeader: 1
)
}
),
a!fileUploadField(
label: "Sube los Tickets",
labelPosition: "ABOVE",
target: cons!PPET_DOCUMENTS_FOLDER_POINTER,
maxSelections: 1,
value: ri!gasto['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{014bca36-cff6-4b6f-87e1-739188a57a1b}importeDelGasto'],
saveInto: ri!gasto['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{014bca36-cff6-4b6f-87e1-739188a57a1b}importeDelGasto'],
required: false,
validations: {}
),
/*a!integerField(*/
/*label: "Total De Los Gastos",*/
/*labelPosition: "ABOVE",*/
/*value: ri!gasto['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{8a53973a-aa9c-4cdb-93b0-a605963f7632}totalDeLosGastos'],*/
/*saveInto: ri!gasto['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{8a53973a-aa9c-4cdb-93b0-a605963f7632}totalDeLosGastos'],*/
/*required: false*/
/*),*/
a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: {
a!richTextItem(
text: {sum(
a!forEach(items: local!articulos, expression: fv!item['recordType!{94ff40c5-e2ec-4c71-8ace-5c709bc4a16b}PFA Gasto.fields.{8a53973a-aa9c-4cdb-93b0-a605963f7632}totalDeLosGastos'])
) & "€"}

  Discussion posts and replies are publicly visible