更新Powerapps全局变量属性

时间:2018-12-29 15:33:31

标签: powerapps

我在PowerApps中有一个全局变量,该变量是在onstart上设置的。

from PyQt5 import QtCore, QtGui, QtWidgets
import os
from tkinter import *
from tkinter.filedialog import askdirectory


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("Auswertung Brechzahlbestimmung")
        MainWindow.resize(1205, 641)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout_5 = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout_5.setObjectName("gridLayout_5")
        self.gridLayout_3 = QtWidgets.QGridLayout()
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.histogram = QtWidgets.QGraphicsView(self.centralwidget)
        self.histogram.setMinimumSize(QtCore.QSize(182, 126))
        self.histogram.setMaximumSize(QtCore.QSize(16777215, 126))
        self.histogram.setObjectName("histogram")
        self.verticalLayout_2.addWidget(self.histogram)
        self.gridLayout_3.addLayout(self.verticalLayout_2, 2, 2, 1, 1)
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout_3.addWidget(self.label, 0, 2, 1, 1)
        self.horizontalSlider = QtWidgets.QSlider(self.centralwidget)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.gridLayout_3.addWidget(self.horizontalSlider, 2, 0, 1, 1)
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setObjectName("label_4")
        self.gridLayout_3.addWidget(self.label_4, 0, 0, 1, 1)
        self.gridLayout_4 = QtWidgets.QGridLayout()
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.gridLayout_3.addLayout(self.gridLayout_4, 1, 4, 1, 1)
        self.seitenansicht = QtWidgets.QGraphicsView(self.centralwidget)
        self.seitenansicht.setMinimumSize(QtCore.QSize(537, 407))
        self.seitenansicht.setObjectName("seitenansicht")
        self.gridLayout_3.addWidget(self.seitenansicht, 1, 2, 1, 1)
        self.verticalSlider = QtWidgets.QSlider(self.centralwidget)
        self.verticalSlider.setOrientation(QtCore.Qt.Vertical)
        self.verticalSlider.setObjectName("verticalSlider")
        self.gridLayout_3.addWidget(self.verticalSlider, 1, 1, 1, 1)
        self.draufsicht = QtWidgets.QGraphicsView(self.centralwidget)
        self.draufsicht.setMinimumSize(QtCore.QSize(537, 407))
        self.draufsicht.setObjectName("draufsicht")
        self.gridLayout_3.addWidget(self.draufsicht, 1, 0, 1, 1)
        self.referenz = QtWidgets.QGraphicsView(self.centralwidget)
        self.referenz.setMinimumSize(QtCore.QSize(70, 0))
        self.referenz.setMaximumSize(QtCore.QSize(70, 16777215))
        self.referenz.setObjectName("referenz")
        self.gridLayout_3.addWidget(self.referenz, 1, 3, 1, 1)
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setObjectName("label_2")
        self.gridLayout_3.addWidget(self.label_2, 0, 3, 1, 1)
        self.gridLayout_5.addLayout(self.gridLayout_3, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

#Here begins the Menubar

        self.menubar =  QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1205, 20))
        self.menubar.setObjectName("menubar")
        self.menuDatei = QtWidgets.QMenu(self.menubar)
        self.menuDatei.setObjectName("menuDatei")
        MainWindow.setMenuBar(self.menubar)


        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.toolBar = QtWidgets.QToolBar(MainWindow)
        self.toolBar.setObjectName("toolBar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)

        self.actionOpen = QtWidgets.QAction(MainWindow)
        self.actionOpen.setObjectName("actionOpen")

        self.actionSave = QtWidgets.QAction(MainWindow)
        self.actionSave.setObjectName("actionSave")
        self.actionExport_Picture = QtWidgets.QAction(MainWindow)
        self.actionExport_Picture.setObjectName("actionExport_Picture")
        self.actionExit = QtWidgets.QAction(MainWindow)
        self.actionExit.setObjectName("actionExit") 

        self.menuDatei.addAction(self.actionSave)

        self.menuDatei.addAction(self.actionOpen)

        self.menuDatei.addSeparator()
        self.menuDatei.addAction(self.actionExport_Picture)
        self.menuDatei.addSeparator()   
        self.menuDatei.addAction(self.actionExit)
        self.menubar.addAction(self.menuDatei.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)



    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Auswertung Brechzahlbestimmung"))
        self.label.setText(_translate("MainWindow", "Schnitt"))
        self.label_4.setText(_translate("MainWindow", "Draufsicht"))
        self.label_2.setText(_translate("MainWindow", "n"))
        self.menuDatei.setTitle(_translate("MainWindow", "Datei"))
        self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
        self.actionOpen.setText(_translate("MainWindow", "Open"))
        self.actionSave.setText(_translate("MainWindow", "Save"))
        self.actionExport_Picture.setText(_translate("MainWindow", "Export Picture"))
        self.actionExit.setText(_translate("MainWindow", "Exit"))



if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

这会将变量CurrentItem设置为

Set(CurrentItem, First(Filter('Internal Review', ID=Value(Param("ID")))))

我想在单击按钮时更新全局变量中的“ myProperty”。我有这个:

{ myProperty: 1, secondProperty: 2 }

,但不起作用。

2 个答案:

答案 0 :(得分:0)

根据您的公式,您的全局变量(CurrentItem)绑定到“内部审阅”源。在您的示例中,当前值为{myProperty:1,secondProperty:2},但是如果在源中更改了相应的值,它将自动更改。您无法更改它,因为这会破坏绑定。 我建议将其复制,然后将所需的更改应用于副本。例如:Set(CurrentItemCopy,{myProperty:CurrentItem.myProperty,secondProperty:3})

答案 1 :(得分:0)

尝试一下 Set(CurrentItem,Patch(CurrentItem,{myProperty:3}))