How to parse HTML table data using angularjs - angularjs

There's a site called NPI registry lookup which will show the information about the doctor you're searching for. Here's the URL https://npiregistry.cms.hhs.gov/registry/search-results-table?number=1023070703. This will list the information in table form for the doctor whose NPI number is 1023070703, for example. What I want to do is build an angular site that will allow users to enter the NPI number, which I'd get the data using $http.get(url). I received the data but it's HTML instead of just the values. How can I parse the HTML table so that I can only pick the data I need? Or is there another better way of fetching the data?
It may sound silly to create another site when there already exists one, but it's for internal purpose only which we need to save a list of doctors that are not yet in our list.

Please read the sites API which is on top right.
For interactive demo:
https://npiregistry.cms.hhs.gov/api/demo
1023070703 becoming something like:
https://npiregistry.cms.hhs.gov/api/?number=1023070703

Related

How to download all attachments of all records of a custom object in Salesforce?

I am new to file handling in Salesforce. I want to grab all the files attached to all the records of a custom object. Can anyone help me with it?
Old-school SF used Attachment object and you could simply go SELECT Body, ContentType, Name FROM Attachment WHERE ParentId = '...'.
In Lightning there's high chance your attachments are called "Files" (the actual API name is ContentDocument / ContentVersion). Check if the attachment's ID starts with 068 or 069. They aren't linked directly to your record. Instead there's ContentDocumentLink table sitting in between, used to cross-share same file. (You upload it and waste database space once, then you can cross-link it in Chatter posts, groups, other records...)
The official ERD isn't great, try to click through it in Setup -> Schema Builder or this answer might help: https://salesforce.stackexchange.com/a/160285/799. There's a sample query which you might have to fine-tune a bit, for example to SELECT ContentDocument.LatestPublishedVersion.VersionData to get the actual payload.
Check out other questions around here about ContentVersion. For example https://stackoverflow.com/a/48668673/313628 (it's other way around, about upload but should give you good idea).
You can export all notes and attachments using open-source sfdx-hardis plugin command
First, define a files export
sfdx hardis:org:configure:files
When prompted for SOQL request, you can input SELECT Id,Name FROM YourCustomObjectName__c
Then, run the files export
sfdx hardis:org:files:export
More details in this article
Disclaimer: My company authors sfdx-hardis plugin

MS Access loading values from a different table to control source in datasheet form

please bear with me; I'm not particularly confident with MS Access, although I am quite experienced with SQL Databases from website work.
For my sins, I have been tasked with developing a database which will unify the hundreds of spreadsheets which we currently use to record details of our clients, work, and other stuff... The database is established and built, but I am now working with the forms to allow data entry.
I have a datasheet form (we have a member of admin staff who is hell-bent on refusing to use forms, so a datasheet form seems to be the best way to appease her!) and it is bound to a specific table ('referrals') to allow a user to input data into that table. It looks like this:
However, I need to be able to load values from another table ('pupil_details') into the 'UPN' field so that if a pupil already exists in the 'pupil_details' table, the user can pick that pupil and have their details automatically filled into the form for convenience.
The form's Record Source is currently:
SELECT referrals.*
FROM referrals;
The most obvious way to do this seemed at first to be to use a join query for the form's record source, along the lines of:
SELECT referrals.*, pupil_details.UPN
FROM referrals LEFT JOIN pupil_details ON referrals.UPN = pupil_details.pupil_id
and then use this as the control source but when I do this, it breaks the functionality of the form (displays all the records, prevents it being used to enter data)
So, can anybody suggest to me how I might be able to get the 'UPN' field to display a list of records based on this query when a user types into it:
SELECT pupil_details.UPN, pupil_details.name, pupil_details.date_of_birth FROM pupil_details
But then enter the details into the 'referrals' table when the user submits the form? Sort of like this that I mocked up in Photoshop:
I'm stumped, and half a day on Google has left me none the wiser... :(
Thanks!
You should use a continuous form, not a datasheet, it will give you a lot more control, but still look like Excel. Once you have the form, you can add a combobox to get the details you want. It is nearly always best to avoid Excel attitudes in Access.

Salesforce - how can I search for all Opportunity custom fields that are empty (never been populated) for every Opportunity record?

I need to search for any opportunity's custom field that are empty for every record, so that I can delete those fields that are not used by the users. Can I do this by report or by DevConsole, with some query?
I think there are three options that would work best:
Data Loader
Use their Data Loader to export all of your opportunities into a CSV. Load it up in Excel or some other software of your choice and manually dig through the columns ending in __c looking for at least one value.
SOQL
You could manually write a SOQL query that looks at each field (e.g. SELECT Id FROM Opportunity WHERE YourCustomField1__c != null and repeat for each field)
SOQL (Dynamic)
If you're willing to get your programming hands dirty you could make a describe API call to fetch all the fields on the opportunity object. Once you know all the fields you could find fields that end in __c again and write a dynamic SOQL statement to hit the API with.
The Field Trip app (free in the AppExchange) will do this for you. Here's a link:
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003HSXEEA4
Run it for an object and it gives you a report that lists all the field and tells you what % of records are filled in for each field. My organization has been using it for several years now.
I'm not connected with Qandor. I'm just a satisfied user.

Delphi 7-How to save pictures in a database

I have been trying to create a select-your-picture-and-upload function of a normal user's profile in Delphi 7, but I am running in some problems.
Basically what I want is the following:
User uploads a picture from a folder (which I have achieved through a normal
OpenPictureDialog component)
Said picture gets stored in a database, which is where I'm stuck.
The database is a normal access database.
The table has a unique ID to identify the members and next to that is the picture of each member on the "Picture field" (which is set as a BLOB object).
So in other words my question is the following:
What components do I need to use in order to save a picture to a specified place in my database?
I have found some random code in the net but I'm running into troubles understanding what it does.
ADOQuery.SQL.Text := 'SELECT PictureField FROM YourTable';
ADOQuery.Open();
ADOQuery.Edit();
TBlobField(ADOQuery.FieldByName('PictureField')).LoadFromFile('PathToPictureFile');
ADOQuery.Post();
You can use imageEn component.
Web Site url to get information and download trial

Generate invoice with Salesforce

I am new in Salesforce and I would like to know how to generate an invoice.
I think to different solutions and I don't know if there are possible, time-consuming, difficult...
A service has different steps.
The service must be invoiced when the step is "completed". a new record have to be added in the table "Invoice" and a link to the invoice document (PDF or Word format)
For the moment, I think to use the section "Note and Attachment Fields". but perhaps that the object "document" is better...
Invoice Creation: I can use the standard button to create a new record but I would like to create it automatically when the status of the file is changed to "completed" for example.
1.I have read the workflow description but I am not sure that it could be use to create automaticaly a specific record in a table.
2.I have also thought to use a button that could fill in the fields and create the record. I fand information to update field with onclick javascript code. But I don't know how to add a record.
Electronic invoice: how can I generate the invoice in PDF or Word format ? and make it available from the record "Invoice n°10" ?
For exemple, the record "Invoice_10" would have an attachment field that contain a link to the document "Inv_010.pdf". The user could open the document from the link.
You might also consider using the standard quote object for your purpose. It comes with a neat PDF generator that is easy to set up. If you set it up right you can (ab)use the quote functionality for creating invoices related to an opportunity. Customizing the New Quote button would allow you to enable this functionality only after the opportunity is closed (using JavaScript). Regarding MS Word generation I recommend DocMocracy: http://www.cloudgizmos.com/salesforce-sfdc-word-excel-document-generator since it is really cheap and you can create read-only word documents.
To answer your first question, you want to write an Apex trigger — run it on your service object (sounds like Opportunity) after insert, and after update, and if the status has been changed to completed then generate your invoice record.
As for generating a PDF invoice you can do this by creating a Visualforce Page and using the renderAs="pdf" attribute in the <apex:page> tag. Storing it against a record will be a bit more tricky, though I suggest you look at examples of how you can attach a Visualforce PDF to an email, you can likely use the same blob object (which stores the content) as a document in Salesforce.
There is already an application: Invoices for Salesforce listed on the Appexchange that automatically creates invoices - records and PDF, straight out of your sales data. The application includes an invoice template editor that gives you complete freedom to design your invoice documents. In addition, the application can automatically deliver the invoices via email, or can group the invoices in files for batch printing in case you need to send them by post or fax.
Check it out: http://www.invoicesforsalesforce.com

Resources