Hi
I'm trying to make an audit app based into a model. The model is based on sql, I addapted to sharepoint list, that's ok. But the model has only two question, I need to addapt to serveral questions (same questions to all users).
The SubmitYesButton has now the code bellow and as you can see is saving each question a time, I need to addapt to consider several questions the most easy way instead of creating a patch for each one, could you help me?
Regards
/*This is the beginning of the Patch fuction*/
/* This section has to remain on the top since it saves the Auditor, Email, Department and also gets it's primary ID*/
Set(IdAuditVar;Patch(Vistorias;Defaults(Vistorias);
{
Responsavel:AuditorNameTextInput.Text;
Email:AuditorEmailTextInput.Text;
Cidade:CidadeDropdown.Selected.Value;
Endereço: EnderecoDropdown.Selected.Value;
Criado:NowVar
}).ID);;
/* This is the beginning of Q1 code*/
/* This section saves Q1 and then get's it's primary ID which is used to save its images*/
Set(IdQ1Var; Patch(VistoriasRespostas;Defaults(VistoriasRespostas);
{
IDVistoria:IdAuditVar;
IDPergunta:1;
Resposta:DataCardQ1Radio.Selected.Value;
Comentario:DataCardQ1CommentTextInput.Text
}).IDPergunta);;
/* This section saves all the images for Q1*/
ForAll(PictureCol1;Patch(VistoriasFotos;Defaults(VistoriasFotos);{
IDResposta:IdQ1Var;
Imagem:Image
}));;
/* This is the end of Q1 code*/
/* This is the beginning of Q2 code*/
/* This section saves Q2 and then get's it's primary ID which is used to save its images*/
Set(IdQ2Var; Patch(VistoriasRespostas;Defaults(VistoriasRespostas);
{
IDVistoria:IdAuditVar;
IDPergunta:2;
Resposta:DataCardQ2Radio.Selected.Value;
Comentario:DataCardQ2CommentTextInput.Text
}).IDPergunta);;
/* This section saves all the images for Q2*/
ForAll(PictureCol2;Patch(VistoriasFotos;Defaults(VistoriasFotos);{
IDResposta:IdQ2Var;
Imagem:Image
}))
/* This is the end of Q2 code*/
/*This is the end of the Patch fuction*/
;;Set(SubmitVar;false)
;;Reset(AuditorNameTextInput);;Reset(AuditorEmailTextInput);;Reset(CidadeDropdown)
;;Reset(DataCardQ1Radio);;Reset(DataCardQ1CommentTextInput)
;;Reset(DataCardQ2Radio);;Reset(DataCardQ2CommentTextInput)
;;Clear(PictureCol1);;Clear(PictureCol2)