1

我有一段代码只在需要时保存项目。

这是代码,

//identify the required organization and Dropdown value
    Set(requiredOrganization,Organization.Selected.OrganizationName.Text);
    Set(DropdownValue, Trim(Dropdown1.Selected.Value));
    If(DropdownValue = "Others", Set(segmentrationalrequired,"Others:" & TextInput3_1.Text),Set(segmentrationalrequired,DropdownValue));

//Identify the Audit Details - // Audit Trail Update
    If(TextInput2_48.Text = "", Set(AuditTrail,TextInput2_48.Text) , Set(AuditTrail, TextInput2_48.Text & Char(13)));
    Set(UpdatedAuditTrail, AuditTrail & "Allocated By " & User().FullName & " on " & Substitute(Text(Now()),":","-") & ". ");

//Update the Graph
        ClearCollect(CurrentYearAllocationsGraphFinal2, 
        {Category: Label11_17.Text, 'Upcoming Year':TextInput2_8.Text,'Current Year':TextInput2_32.Text},
        {Category: Label11_18.Text, 'Upcoming Year':TextInput2_9.Text,'Current Year':TextInput2_33.Text},
        {Category: Label11_19.Text, 'Upcoming Year':TextInput2_10.Text,'Current Year':TextInput2_34.Text},
        {Category: Label11_20.Text, 'Upcoming Year':TextInput2_11.Text,'Current Year':TextInput2_35.Text});

//Save the value in the One Drive file Table
        If(And(Label11_23.Text = "100", segmentrationalrequired <> "",segmentrationalrequired <> "Others:",DropdownValue<>Blank()), Patch(Table1,
        First(Filter(Table1, 'Organizational Code by Function Head' = requiredOrganization)),
        {'100 or Less': (Value(TextInput2_8.Text))/100}, 
        {'Premier (100 - 4,999)': (Value(TextInput2_9.Text))/100}, 
        {'NAO (>5,000)': (Value(TextInput2_10.Text))/100}, 
        {Association: (Value(TextInput2_11.Text))/100},
        {'Segment Rationale': segmentrationalrequired},
        {'Current Status':"Ready to be Sent for Approval"}, 
        {'Allocated By' : User().FullName},
        {'Segment Rationale File Details':TextInput2_37.Text}, 
        {'Allocated On': Now()}, 
        {'Audit Details': UpdatedAuditTrail}
        ),
        Notify("Allocations must total 100%. Please include your Allocation Methodology"));

//Refresh if Successful
        If(And(Label11_23.Text = "100", segmentrationalrequired <> "",segmentrationalrequired <> "Others:",DropdownValue<>Blank()),
        Refresh(Table1) & Refresh(Table4));

//Set default selected item of a gallery
Set(default_gallery_Market,First(Filter(Table1, 'Organizational Code by Function Head' = requiredOrganization)));

是否有更好的方法来编写此代码,因为它目前正在影响性能。

如果保存失败并且不再从那里继续运行,我可以停止运行代码吗?

4

0 回答 0