How to display e specific property in a Neo4j node - neo4j

I`m creating a graph in Neo4j, but is there a way to define which property of the node to be displayed, when I browse the nodes in Neo4j browser?
In my case for the node Flight I want the property FL_NUM to be displayed in the node, but it automatically shows another property: DIV_AirportLandings, as shown below.
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS
FROM "file:///Flight_data/5may2018.csv" AS line
WITH DISTINCT line
MERGE (f:Flight { id: TOINT(line.`flight_id`)} )
SET f.FlightNum = line.FL_NUM
SET f.Distance = line.DISTANCE
SET f.Diverted = line.DIVERTED
SET f.Cancelled = line.CANCELLED
SET f.CRS_ElapsedTime = line.CRS_ELAPSED_TIME
SET f.Actual_ElapsedTime = line.ACTUAL_ELAPSED_TIME
SET f.DIV_AirportLandings = line.DIV_AIRPORT_LANDINGS
SET f.DIV_ReachedDest = line.DIV_REACHED_DEST
Thank you

In the result pannel (just under the query), you have facet for labels.
Just click on the Filght(25) and then a bar will appears at the bottom of the frame where you can select the color, size and the property to display.

Related

Vaadin Combobox does not shows nameField from database

I have a service class. When I set items alldata() in my combo box then it shows all the embedded data from the database. how can I just set the name field?
example:
private ComboBox groundComboBox = new ComboBox<>("Ground");
groundComboBox.setItems(groundService.getAllGround());
it shows:
Ground(groundId=Shere-Bangla, groundName=Shere-Bangla national stadium, city=Dhaka, country=Bangladesh, longitude=90.8, latitude=45.7, capacity=10000, inaugurationDate=2005-02-05).
i just want to show the only name;
You need to set the label generator to define what will be the label of each item.
groundComboBox.setItemLabelGenerator(Ground::getName);
or
groundComboBox.setItemLabelGenerator(ground -> ground.getName());

Open/Libre Office macro to scroll view to selection

In Writer, I would like to search for some text and when found position the view to the top of the view/window.
Using the following code,
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "SearchItem.SearchString"
args1(0).Value = ":"
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())
the view changes and it shows the selection but it is not in any particular place. I want it to be at the top of the window/view.
I've also found elsewhere the use of ThisComponent.currentController.getViewData() and restoreViewData(). So I experimented and determined how to change the data returned in order to get a vertical scroll but nothing happens. For example...
vd = ThisComponent.currentController.getViewData()
vdParts = Split(vd, ";")
vdParts(6) = CLng(vdParts(6)) + 1000
vd = join(vdParts, ";")
ThisComponent.currentController.restoreViewData(vd)
Any suggestions?
PS: I am running version 5.0.5.2 on Windows 7 x64
Spreadsheets have View Panes that can be manipulated, but it does not look like there is a similar interface in Writer.
Instead, use the View Cursor to go down one or two pages, then move back to the location of the search result.
Also, do not use the dispatcher for the search. Use the API instead, like in section 7.14 of Andrew Pitonyak's macro document.

Transfer a data set from openoffice base to calc

After I did a query in openoffice-base over a customized form I want to transfer a selected set of data into a template openoffice-calc table. I know I can access the data set in openoffice-calc via pressing the Data Source (F4) button but then I only get access over the query. The best solution would be after the database query over a form a button event is required to open a openoffice-calc table from the template and insert the data from the data set.
First go to Tools -> Macros -> Organize Macros -> LibreOffice Basic and add this code. Change the path of the template file.
Sub Copy_Record_To_Calc(oEvent)
Dim oForm
Dim templatePath As String
Dim oServiceManager As Object, oDesktop As Object
Dim oFileProperties As Object
Dim oDoc As Object, oSheet As Object, oCell As Object
Dim column As Integer
oForm = oEvent.Source.getModel().getParent()
If oForm.isAfterLast() Then
Print "Hey, you are after the last element."
Exit Sub
ElseIf oForm.isBeforeFirst() Then
Print "Hey, you are before the first element."
Exit Sub
End If
templatePath = "file:///C:/Users/JimStandard/Desktop/Untitled 2.ots"
Set oServiceManager = CreateObject("com.sun.star.ServiceManager")
Set oDesktop = oServiceManager.createInstance("com.sun.star.frame.Desktop")
Set oFileProperties(0) = new com.sun.star.beans.PropertyValue
oFileProperties(0).Name = "AsTemplate"
oFileProperties(0).Value = True
Set oDoc = oDesktop.loadComponentFromURL( _
templatePath, "_blank", 0, Array(oFileProperties))
oSheet = oDoc.Sheets(0)
For column = 1 to 2
oCell = oSheet.getCellByPosition(column - 1, 0)
oCell.String = oForm.getString(column)
Next column
End Sub
Then in form design mode, right-click on the button and choose Control. In the Events tab, click the three dots next to Execute action. Click Macro... and find the Copy_Record_To_Calc macro that you added.
Now turn design mode off. Go to a record and click the button. It will open the Calc template and copy the first two columns of the current record into column A and B of the spreadsheet.
See also:
Section 4.2.1 of Andrew Pitonyak's Base Macros (PDF)
ResultSet documentation
This thread gives an example of using a Calc template.

Not able to use setFillColor method on display objects within a table

So I have a collection of display objects in a table, inserted like so (some excess code was taken out):
for i=1,blockCount do
local block=display.newRect(xcoord,ycoord,blockwidth,blockheight);
local color=blocks[i];
if(color=="red") then
block:setFillColor(1,0,0);
block.collision = redHit;
block:addEventListener( "collision",block);
elseif(color=="blue") then
block:setFillColor(0,0,1);
block.collision = blueHit;
block:addEventListener( "collision",block);
block.hp=0;
elseif(color=="yellow") then
block:setFillColor(1,1,0);
block.collision = yellowHit;
block:addEventListener( "collision",block);
else
end
block.blockColor=color;
grid[i]=block;
end
So grid is just a table full of rectangle objects with different properties. However, in a different spot in the code, I am trying to do this:
for i=1,blockCount do
if (grid[i]~=nil) then
local color=grid[i].blockColor;
if (color=="blue") then
grid[i]:setFillColor(1,0,0);
grid[i].collision = redHit;
grid[i].blockColor="red";
elseif (color=="red") then
grid[i]:setFillColor(0,0,1);
grid[i].collision = blueHit;
grid[i].blockColor="blue";
grid[i].hp=0;
end
end
end
In other words, at this spot in the code, I am trying to make all red blocks blue and all blue blocks red. But it's throwing an error that it's unable to change the fill color (saying it's a nil value). Because it is getting there, it is pulling the information from the object by seeing its color, so it is not unable to access properties and functions of the object, and if I comment out that line, changing the other properties works. Why would it not be able to run this simple function?
It means that yours grid table contains not only block elements. So one of elements stored in grid table contains no ".blockColor".
Change it to:
if (grid[i]~=nil and grid[i].blockColor) then

Neo4j Load csv on create set if not null

Is there a way in Neo4j to use ON CREATE SET with an IF NOT NULL?
I have a cvs file as such:
employeeid,firstname,lastname,suffix,title
1,john,baker,,mr
2,ellie,johnston,,mrs,
3,bob,smith,jr,,
My current load statement:
LOAD CSV from 'file://file' AS line
WITH line
MERGE (a:Employee {id:TOINT(line.`employeeid`)})
ON CREATE SET a.firstname = line.`firstname`, a.lastname = line.`lastname`, a.suffix = line.`suffix`
How would I change this so it won't set an attribute if null but still set those that have values?
If you set an attribute to null it will actually not be created.

Resources