Listing buildings' thematic data with 3D Web Map Client - cesiumjs

I'm using 3D Importer/Export to import a .gml file to a Postgres 3D CityDB.
Now I want to visualize the buildings on the map and list their characteristics. I've managed to visualize them, but as far as the characteristics go, I'm having some trouble. I'm using PostgREST for serving the thematic data. The issue I've encountered and can't seem to find a solution to is that the 3D CityDB has information about a building spanning multiple tables but 3DWMC queries only one table. When clicking a table, 3DWMC executes a request to the URL that I've specified + ?gmlid={the id of the building I've clicked}. The only table that seems to have a gmlid field is cityobject.
Here is the configuration of 3DWMP I have:
The URL is http://localhost:8000/exports/export7/export.kml and the cityobjectsJsonUrl is http://localhost:8000/exports/export7/export.json.
And here is the information that is displayed when clicked:
In a nutshell, I want to display the address of a building (for example) when clicked.

Well, I eventually figured it out.
You have to create a materialized view and the query against it.
Here is the view named view_attributes (credit goes to this issue):
SELECT cityobject.gmlid,
concat('address '::text, row_number() OVER (PARTITION BY address_to_building.building_id)) AS attribute,
concat(address.street::character varying(255), ' ', address.house_number::character varying(255), ', ', address.zip_code::character varying(255), ', ', address.city::character varying(255), ', ', address.country::character varying(255)) AS value,
0 AS order_vba
FROM cityobject,
building
JOIN address_to_building ON building.id = address_to_building.building_id
JOIN address ON address.id = address_to_building.address_id
WHERE cityobject.id = building.id
And then changed the thematicDataUrl in the UI to: http://localhost:3000/view_attribute.

Related

Mass Upload Files To Specific Contacts Salesforce

I need to upload some 2000 documents to specific users in salesforce. I have a csv file that has the Salesforce-assigned ContactID, as well as a direct path to the files on my desktop. Each contact's specific file url has been included in the csv. How can I upload them all at one and, especially, to the correct contact?
You indicated in the comments / chat that you want it as "Files".
The "Files" object is bit more complex than Attachments, you'll need to do it in 2-3 steps. What you see as a File (you might see it referred to in documentation as Chatter Files or Salesforce Content) is actually several tables. There's
ContentDocument which can be kind of a file header (title, description, language, tags, linkage to many other areas in SF - because it can be standalone, it can be uploaded to certain SF Content Library, it can be linked to Accounts, Contacts, $_GOD knows what else)
ContentVersion which is well, actual payload. Only most recent version is displayed out of the box but if you really want you can go back in time
and more
The crap part is that you can't insert ContentDocument directly (there's no create() call in the list of operations) .
Theory
So you'll need:
Insert ContentVersion (v1 will automatically create for you parent ContentDocuments... it does sound bit ass-backwards but it works). After this is done you'll have a bunch of standalone documents loaded but not linked to any Contacts
Learn the Ids of their parent ContentDocuments
Insert ContentDocumentLink records that will connect Contacts and their PDFs
Practice
This is my C:\stacktest folder. It contains some SF cheat sheet PDFs.
Here's my file for part 1 of the load
Title PathOnClient VersionData
"Lightning Components CheatSheet" "C:\stacktest\SF_LightningComponents_cheatsheet_web.pdf" "C:\stacktest\SF_LightningComponents_cheatsheet_web.pdf"
"Process Automation CheatSheet" "C:\stacktest\SF_Process_Automation_cheatsheet_web.pdf" "C:\stacktest\SF_Process_Automation_cheatsheet_web.pdf"
"Admin CheatSheet" "C:\stacktest\SF_S1-Admin_cheatsheet_web.pdf" "C:\stacktest\SF_S1-Admin_cheatsheet_web.pdf"
"S1 CheatSheet" "C:\stacktest\SF_S1-Developer_cheatsheet_web.pdf" "C:\stacktest\SF_S1-Developer_cheatsheet_web.pdf"
Fire Data Loader, select Insert, select showing all Salesforce objects. Find ContentVersion. Load should be straightforward (if you're hitting memory issues set batch size to something low, even 1 record at a time if really needed).
You'll get back a "success file", it's useless. We don't need the Ids of generated content versions, we need their parents... Fire "Export" in Data Loader, pick all objects again, pick ContentDocument. Use query similar to this:
Select Id, Title, FileType, FileExtension
FROM ContentDocument
WHERE CreatedDate = TODAY AND CreatedBy.FirstName = 'Ethan'
You should see something like this:
"ID","TITLE","FILETYPE","FILEEXTENSION"
"0690g0000048G2MAAU","Lightning Components CheatSheet","PDF","pdf"
"0690g0000048G2NAAU","Process Automation CheatSheet","PDF","pdf"
"0690g0000048G2OAAU","Admin CheatSheet","PDF","pdf"
"0690g0000048G2PAAU","S1 CheatSheet","PDF","pdf"
Use Excel and magic of VLOOKUP or other things like that to link them back by title to Contacts. You wrote you already have a file with Contact Ids and titles so there's hope... Create a file like that:
ContentDocumentId LinkedEntityId ShareType Visibility
0690g0000048G2MAAU 0037000000TWREI V InternalUsers
0690g0000048G2NAAU 0030g000027rQ3z V InternalUsers
0690g0000048G2OAAU 0030g000027rQ3a V InternalUsers
0690g0000048G2PAAU 0030g000027rPz4 V InternalUsers
1st column is the file Id, then contact Id, then some black magic you can read about & change if needed in ContentDocumentLink docs.
Load it as insert to (again, show all objects) ContentDocumentLink.
Woohoo! Beer time.
Your CSV should contain following fields :
- ParentID = Id of object you want to link the attachment to (the ID of the contact)
- Name = name of the file
- ContentType = extension(.xls or .pdf or ...)
- OwnerId = if empty I believe it takes your user as owner
- body = the location on your machine of the file (for instance: C:\SFDC\Files\test.pdf
Use this csv to insert the records (via data loader) into the Attachment object.
You will then see for each contact, that records have been added to the 'Notes & Attachments' related list.

How do I download only my purchase invoice documents from Exact Online with Invantive Query Tool?

To comply to regulations, I'm trying to download the purchase invoice documents (as PDF files) from some of my divisions to save them on-disk for archiving purposes.
I use Invantive Query Tool to do this. I like to know which table to use and how to export these attachments only regarding purchase invoice documents.
You can indeed do this by using the export options in Invantive Query Tool or Invantive Data Hub.
What you need is a query that hooks up the document information of type 20 (purchase invoices) with the actual attachment files. You can find a list of types and their description in the DocumentTypes view. You can find the document attachment files in the DocumentAttachmentFiles table.
When you have retrieved that, you can export the documents from that query to disk using a local export documents statement.
The full query is here:
use 123456
select /*+ join_set(dae, document, 10000) */ attachmentfromurl
, dct.division || '/' || dae.id || '-' || filename
filepath
from exactonlinerest..documents dct
join DocumentAttachmentFiles dae
on dae.division = dct.division
and dae.document = dct.id
where dct.Type = 20
order
by dct.division
, dae.id
local export documents in attachmentfromurl to "c:\temp\docs" filename column Filepath
Make sure to set the ID of the division right in the use statement (this is the technical ID, not the 'division number', which can contain duplicates). You can find that in the top menu bar under Partitions. Or simply use use all to get the documents from all divisions (this might take a while).
Also set the file path right where it says c:\temp\docs now. Then hit F5 in the Query Tool to execute, or run the script from Data Hub.

Need to identify dynamic text value in selenium python

I am new to selenium webdriver python . I need to automate back end process of an e-commerce application ( order processing)
here the orders are classified to three types :
say A-type , B-type and C-type .
After successful order completion the orders will listed in an interface .
In all listed orders, its order type will mentioned like
"ORDER TYPE:A-type"
According to these three types certain scenarios will be executed. I need to identify this type. In a page there may be more than one A-type/B-type/C-type orders.
here the orders will be listing one by one will all user details along with order type. please help in this.
its html tag details:
order Type: A-type

Create new column in mySQL using values from other columns

I have two columns in my database I'd like to combine to make a new third column. The first column is a company name and the second is the URL to the company website.
I'd like to make a new column that is the company name hyperlinked to the website:
<a href="http://companywebsite.com>Company Name</a>
Is there a simple way to go about doing this? I'm VERY new to mySQL and can't figure out how I'd even go about doing this.
Bonus points for coming up with a way where when I add a new entry with company name and URL it automatically generates a value for this new hyperlink column.
Thanks.
As Polvonjon write, use CONCAT:
SELECT brief_description, CONCAT('', innovation_name, '') FROM inno_db
By the way - inno_db is a very odd name for a table in the database; it's a particular type of storage engine for MySQL. Do you not think "companies" is a better name?
Creating a new column is a bad idea - you have to keep it updated, and you're duplicating data, which leads to bugs in the long term. Ideally, you use the query to populate your WP screen.
If you can't do that, as the comments recommend, you could create a view, from which you can just do a straight select:
create view WPPlugin
as
select brief_description,
CONCAT('', innovation_name, '')
FROM inno_db
in your plug in code, you then do select * from WPPlugin.
Try use CONCAT function:
SELECT company, url, CONCAT('', company, '') FROM companies
But I will not advice to using this sample of getting anchor tag.
Try to use VIEW element in your MVC app.
Assuming you have a table with three columns
CREATE TABLE mytable (
company_name text
, url text
, hyperlink text
)
Then you would need to UPDATE the value of the third column (hyperlink) based on what you need, something like:
UPDATE mytable
SET hyperlink = '<a href="http://' || url || '>' || company_name || '</a>';

PHP/MySQL - Changing Query on clicking a link

I have a very basic site (just learning this stuff) where I have the results for a hockey pool I do from here.
I want to build a page that lists the players and then when they click on a name, a page comes up with just that player's picks on it. You can see the kind of page I mean here.
THis page currently only shows one player, as I am using this query:
$q = "SELECT *, player_id, handle
FROM round_one
INNER JOIN players USING (player_id)
WHERE (player_id = 1)";
Right now I have it set just to return player_id 1, but I want it to do player_id 2, 3, 4 etc depending on what linked name they click on.
I have been reviewing some documentation on sort by columns queries when clicking on a column header, and am thinking this is sort of the approach I should be taking, but I just can't seem to figure out the correct way to do it.
You can achieve this by passing a parameter to the view_picks_by_player.php page, and then PHP can pick up that parameter and generate content for the appropriate player.
For example, in the page where you select the player you want stats for you could have:
<a href='view_picks_by_player?id=player1'>Get Player 1's Stats!</a>
<a href='view_picks_by_player?id=player2'>Get Player 2's Stats!</a>
And then in the top of the view_picks_by_player.php page you could have:
$id = $_GET['id'];
$sql = "SELECT * FROM player_stats WHERE id = '$id'";
Obviously your SQL is structured differently, but this is just a quick way to show how you can pass a variable to the php page so it can generate different content dynamically.
For security, you'll want to validate that the user has not typed anything nasty into the URL as the 'id' before you use it in your SQL, but that's another topic...