我已经研究过,但无法找到问题的答案。我的目标是在SSRS中使用#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
# from wikipedia
my_xpm = [
"24 20 3 1 12 10 XPMEXT",
" c None",
". c #0000FF",
"+ c #FF0000",
" ",
" .. ",
" .... ",
" ......++++++++ ",
" .........+++++++ ",
" ..........+++++++ ",
" ............++++++ ",
" .............++++++ ",
" ..............++++ ",
" +.............+++ ",
" ++.............++ ",
" +++.............+ ",
" +++++............. ",
" ++++++.............. ",
" ++++++++............ ",
" +++++++++........... ",
" +++++++++......... ",
" ++++++++++....... ",
" ++++++++++..... ",
" +++++++++ ... "
]
class MainWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="TreeView Drag and Drop")
self.connect("delete-event", Gtk.main_quit)
self.box = Gtk.Box()
self.add(self.box)
# "model" with dummy data
self.store = Gtk.TreeStore(str)
for i in range(5):
self.store.append(None, ['Item {}'.format(i)]) # treeview
self.tree = Gtk.TreeView(model=self.store)
self.box.pack_start(self.tree, True, True, 0)
# build columsn
colA = Gtk.TreeViewColumn('Col A', Gtk.CellRendererText(), text=0)
self.tree.append_column(colA)
# icon view
self._icon = GdkPixbuf.Pixbuf.new_from_xpm_data(my_xpm)
self.image = Gtk.Image.new_from_pixbuf(self._icon)
self.box.pack_start(self.image, True, True, 0)
# DnD events
self.tree.connect("drag-data-received", self.drag_data_received)
self.tree.connect("drag-data-get", self.drag_data_get)
#self.tree.connect("drag-begin", self.drag_begin)
self.tree.connect_after("drag-begin", self.drag_begin)
target_entry = Gtk.TargetEntry.new('text/plain', 2, 0)
self.tree.enable_model_drag_source(
Gdk.ModifierType.BUTTON1_MASK,[target_entry],
Gdk.DragAction.DEFAULT|Gdk.DragAction.MOVE
)
self.tree.enable_model_drag_dest(
[target_entry],
Gdk.DragAction.DEFAULT|Gdk.DragAction.MOVE
)
def drag_data_get (self, treeview, drag_context, data, info, time):
model, path = treeview.get_selection().get_selected_rows()
print('dd-get\tpath: {}'.format(path))
data.set_text(str(path[0]), -1)
def drag_data_received (self, treeview, drag_context, x,y, data,info, time):
print('dd-received')
store = treeview.get_model()
source_iter = store.get_iter(data.get_text())
dest_path, drop_pos = self.tree.get_dest_row_at_pos(x, y)
print('path: {} pos: {}'.format(dest_path, drop_pos))
def drag_begin(self, widget, context):
self._drag_icon = GdkPixbuf.Pixbuf.new_from_xpm_data(my_xpm)
widget.drag_source_set_icon_pixbuf(self._drag_icon)
return context
win = MainWindow()
win.show_all()
Gtk.main()
函数,该函数目前正在按预期执行。但是,我有不存在的空值,我将其表示为“ 0”。看来我应该能够将Lookup
表达式与Lookup
函数一起使用。但是,我找不到这样的例子。有什么想法我可以做到这一点吗?我的IIF
表达式如下。
Lookup
答案 0 :(得分:0)
我将使用IsNothing
函数检查该值是否为Null并将其包装在IIF
表达式中。这是用于不同表达式的Microsoft reference。
=IIF
(
IsNothing(LookUp(Fields!SKU.Value, Fields!ItemCode.Value, Fields!Store.Value, "DataSet3"))
, 0
, LookUp(Fields!SKU.Value, Fields!ItemCode.Value, Fields!Store.Value, "DataSet3")
)