PowerApps 将表单提交到另一个数据源
PowerApps SubmitForm to another datasource
我正在尝试实现 Outlook 等离线功能。如果离线,它应该将值从 EditForm1 放置到本地集合(发件箱)。是否可以根据 Connection.Connected 变量将编辑表单提交到不同的来源?然后我会创建一个计时器,它在每 x 秒连接时提交一次。
如果我理解正确的话,您想将当前在 EditForm1 中的内容保存到本地集合中,并且在再次连接到互联网后,您想再次提交表单。
如果您已连接到 Internet,则需要使用条件来保存当前在表单中的数据,否则将其收集到临时集合中。
If(ToggleIsConnected.Value,
//If you are connected to the internet, then write the data to the database.
SubmitForm(Form1),
//If you are NOT connected to the internet, then write the data to a temporary collection to be written later.
Collect(temporary,
{id: Max(temporary,id)+1,
column1: InputColumn1.Text,
column2: InputColumn2.Text
}
);
SaveData(temporary,"temporary")
)
您可以使用 Toggle 检查互联网连接。如果您失去连接、在本地保存数据并重新连接,切换将触发并自动执行 OnCheck 操作:
If(!IsEmpty(temporary),
// If the connection returns and there are records to be written,
// then perform these actions:
ForAll(temporary,
// For each of the records in the temporary collection,
// save their data to a new row in the connected datasource.
// If writing was successful, copy it to a collection called 'success'
// to identify it.
Collect(success,
{id: id,
Record:
Patch(datasource,Defaults(datasource),
{column1: column1,
column2: column2
}
)
}
)
);
If(IsEmpty(Errors(datasource)),
// If there are no errors with the datasource,
// go ahead and clear the entire temporary collection since you're writing.
Clear(temporary),
// Otherwise if there is an error, remove only the records that were successful.
// Then clear the successful records.
// Keep records that had an error so they could be attempted later.
Remove(temporary,Filter(temporary,id exactin Filter(success,!IsBlank(Record)).id));
Clear(success)
)
)
请注意,我在这里使用 Patch() 来保存临时集合中的内容。除非我填写表格,否则我无法使用 SubmitForm。
进一步实施还涉及更多步骤。请参阅我关于此主题的视频以获取更详细的信息:
https://www.youtube.com/watch?v=j30xOM5OmRE
我正在尝试实现 Outlook 等离线功能。如果离线,它应该将值从 EditForm1 放置到本地集合(发件箱)。是否可以根据 Connection.Connected 变量将编辑表单提交到不同的来源?然后我会创建一个计时器,它在每 x 秒连接时提交一次。
如果我理解正确的话,您想将当前在 EditForm1 中的内容保存到本地集合中,并且在再次连接到互联网后,您想再次提交表单。
如果您已连接到 Internet,则需要使用条件来保存当前在表单中的数据,否则将其收集到临时集合中。
If(ToggleIsConnected.Value,
//If you are connected to the internet, then write the data to the database.
SubmitForm(Form1),
//If you are NOT connected to the internet, then write the data to a temporary collection to be written later.
Collect(temporary,
{id: Max(temporary,id)+1,
column1: InputColumn1.Text,
column2: InputColumn2.Text
}
);
SaveData(temporary,"temporary")
)
您可以使用 Toggle 检查互联网连接。如果您失去连接、在本地保存数据并重新连接,切换将触发并自动执行 OnCheck 操作:
If(!IsEmpty(temporary),
// If the connection returns and there are records to be written,
// then perform these actions:
ForAll(temporary,
// For each of the records in the temporary collection,
// save their data to a new row in the connected datasource.
// If writing was successful, copy it to a collection called 'success'
// to identify it.
Collect(success,
{id: id,
Record:
Patch(datasource,Defaults(datasource),
{column1: column1,
column2: column2
}
)
}
)
);
If(IsEmpty(Errors(datasource)),
// If there are no errors with the datasource,
// go ahead and clear the entire temporary collection since you're writing.
Clear(temporary),
// Otherwise if there is an error, remove only the records that were successful.
// Then clear the successful records.
// Keep records that had an error so they could be attempted later.
Remove(temporary,Filter(temporary,id exactin Filter(success,!IsBlank(Record)).id));
Clear(success)
)
)
请注意,我在这里使用 Patch() 来保存临时集合中的内容。除非我填写表格,否则我无法使用 SubmitForm。
进一步实施还涉及更多步骤。请参阅我关于此主题的视频以获取更详细的信息: https://www.youtube.com/watch?v=j30xOM5OmRE