Foundry Slate - Table widget get cell value - palantir-foundry

In Slate I have a table widget and like to read out values from cells by clicking the cell. I heard it might work using 'ClickEvent' but I have no clude how to do this :-(
Anyone has experience?
I tried nothing becuase I don't know how.
I like to read out a cell to use as a filter to filter the table.

You can find the documentation for custom ClickEvent handlers for Table and HTML widgets and how to pass values into Events through these clicks in the Slate Best Practices docs.
You can also look in the Slate reference examples on your Foundry instance and find some interactive apps to work from.
/Foundry Training and Resources/Reference Examples/Application Development in Slate/1. Tutorials/2. Tutorial - Intro to Slate Hidden Features has an example at the very bottom of a table with buttons embedded in each row that works using the custom ClickEvent framework.
There are lots of other reference examples for all kinds of Slate implementation patterns in these folders that might be relevant to explore.

Related

Moving an item from one Google form to a new Google form using google apps script

When editing a Google form manually, you can usually click on an item, and on the side appears a menu, which includes the button "import questions". This button is very useful for me as it allows me to collect questions from past Google forms and import them to new Google forms.
But I'm looking through the Forms documentation, and I can't figure out how to do this via Google apps script programatically.
Here is the documentation:
https://developers.google.com/apps-script/reference/forms/form
The closest thing to what I want is the .moveItem() method, which moves an item from one spot in a form to another. But it only works within the same form. I want to know if I could do it across forms. And ideally, instead of moving the item, it would make a copy of the item in the new form.
I considered the .getItems() method, but there doesn't seem to be a general .addItem() method I could use on the new form. Would I have to go through the painstaking process of having to identify each item type, and specify how the details of each one should be copied to the new form, including things like point values of a question and whether or not the question is required?
I want to import from forms that have all kinds of content: video, images, multiple choice questions, grid questions, number scale questions, etc. I feel that if I have to specify the details of each item type, it would take too long, and I would be bound to miss something or run into an error that may be impossible to solve. Is there not an easier way?
And if specifying each item type is what I have to do to import everything properly, has someone else created that code already that I can re-use?
Issue:
In the current stage, unfortunately, it seems that Forms Service cannot copy all items. Ref1, Ref2 Ref3. And, unfortunately, moveItem can be used for the same Google Form as you say.
Workaround:
In your situation, as a workaround, how about copying the source Google Form? And, when there are some items you want to remove, you can remove them. I thought that this process can be achieved by Google Apps Script.
But, I'm not sure about your actual Google Form. So I'm not sure whether this is a suitable method.
Future:
Recently, Google Forms API was announced. Ref When this API got to be able to be used, your goal might be able to be achieved by retrieving the object from Google Form. Unfortunately, I'm still not sure about the detail of it.

How to embed a single Google Sheets cell's text content into a web page?

Background: I have a Google Sheet that automatically manages key organization event dates, but occasionally one has to be manually overridden. I have been duplicating those auto calc'd event dates using PHP on the organization's web page but that doesn't handle it when the event dates are manually changed back in the Sheets database.
Need Statement: I wish to grab the text content of the Google "DateCalc" Sheet, cell "A33" (which contains the corrected next Date) and embed it automatically in a web page sentence that states, "The next event is scheduled for ???." where "???" is whatever is needed for the HTML embed effort for the text content of cell A33.
All the embedding approaches I have tried using the publish to web feature of Sheets, just display a frame with the entire Sheets page content, and I have not been able to find a simple single text display approach, which is what I seek. All the solutions I have found so far are for much more complex situations. I believe I don't need any more code on the Sheet (source) end, just an appropriate "embed code snippet" at the destination end.
I can embed a complete sheet but haven't found a way to embed a simple text string in line with the surrounding text in the sentence.
This web script is the closest I have been able to come...
Our next meeting is on <object data="https://docs.google.com/spreadsheets/d/e/2PACX-1vQq6sXBel4SOW5U_XLnQ1xyyl4P-aK2v1R-5uofUvstMLV89_yCSqX3Lmsy4B7E21gojeG88efGFjZ0/pubhtml?gid=604484136&single=true&range=A29&chrome=false" type="text/html" width="171" height="15"></object>.
but, if the Code Snippet really ran (I changed the file ID to protect the innocent), you would see it doesn't produce an in-line text string but an isolated "block" with the text inside it, as shown below....
The text seems to be an image, not text, that is displaced above the text baseline and has a small gray blob following it that I just can't get rid of.
I'll assume that your server uses a combination of PHP and HTML, so one approach can be to use that PHP code to make a call to the Sheets API to retrieve the data. In the PHP Sheets API Quickstart you can find a example of how to set up a project to achieve a working connection between your server and the API. After you complete the tutorial, you can modify your script to include the following function so you can achieve your original request.
function getNextDate() {
$client = getClient();
$sheetsService = new Google_Service_Sheets($client);
$spreadsheetID = '{YOUR SPREADSHEET ID}';
$cellRange = 'DateCalc!A33';
$serverResponse = $sheetsService->spreadsheets_values->get($spreadsheetID, $cellRange);
$cellValue = $serverResponse->getValues();
if (empty($cellValue)) {
return "NO MEETINGS AHEAD!\n";
} else {
foreach ($cellValue as $value) {
return $value[0];
}
}
}
A totally different alternative is to use a webapp. You can use this tutorial to deploy a webapp that can be later embedded in your webpage to show the following meeting dates.
So there are two free alternatives to accomplish your objectives: using the Sheets API or a webapp; and in this anwser I provided a function for the API option. Please, don't hesitate to offer information for further clarifications or request for help.
Our next meeting is on
.
I built a free, open source, and easy to use service and badge generator called https://cellshield.info. It works out of the box for public Google spreadsheets. What you see above is a live Markdown output version of a badge that is synced from a spreadsheet with the value formatted as what was shown in your example with a formula of TODAY(). The Markdown just makes an image tag which I suppose you can do with anything else that can make an image tag as well.
If you want the yellow or any formatting to to go away, try this:
Our next meeting is on
.
This was done by adding &color=rgba%28255%2C255%2C255%2C0.0%29&style=flat-square to the arguments. The text doesn't match perfectly, it's servicable.
Anyway, I see you went with tabletop but if you or anyone else is just looking to do what you wanted to do, then my service should be sufficient.
For example, it is used for this Game Boy development contest to present the prize pool amount.
If a private spreadsheet solution is needed, one could fork my code, run it on Cloud Run in their Google Cloud Platform account and explicitly share the spreadsheet to the service account on their Google Cloud Platform instance.
Jacques-
Merci beaucoup !
It has been a challenging several days of non-stop effort but you put me on the right track.
Using less than 20 lines of JavaScript code, including one line for the free TableTop.js library call (see https://github.com/jsoma/tabletop#if-your-publish-to-web-url-doesnt-work) and inserting a string in the middle of my HTML sentence, yielded EXACTLY what I was seeking and the solution was INFINITELY SIMPLIER than virtually everything else I found that required multiple libraries, subscription fees, complex system calls, etc.
The hardest part was inserting the JavaScript code into WordPress which my web site is constructed with, as you can essentially only insert plain text into a WordPress page, but with the an added WordPress plugin (Insert Header and Footers) you can put code into a WordPress page.
Many thanks for getting me headed in the right direction, and having a great learning experience along the way. :-)

Create two textBoxes/Dropdowns side by side Google App Script [Gmail Add-on]

Can anyone please suggest how to add two Widgets/InputTextBoxes side by side in a Google Apps Script [Gmail Add-on] ?
Sample Code:
var section = CardService.newCardSection();
section.addWidget(
CardService.newTextInput()
.setTitle("Title1")
.setFieldName("field1")
);
section.addWidget(
CardService.newTextInput()
.setTitle("Title2")
.setFieldName("title2")
);
The above Google Apps script code creates two InputText fields one below the other in Gmail Add-on.
Is there any way to create two TextInputFields/Dropdowns/Widgets in a same row? [next to each other]
Something like these:
Thanks,
Side-by-side (a.k.a. "in-line fields" in other products) can't currently be done, and will likely remain this way solely because of the width of the add-on sidebar. Google's style guide already recommends that you use a multi-line text input box if you are anticipating "more than a few words." I consider it unlikely for Google to extend their CardService implementation to add an "in-line" flag given their recommendation.
The reason for this restriction no doubt lies in the purpose of CardService:
The UI structures you build with this service are automatically available in both desktop and mobile devices, so you don't need to develop separate UIs for both.
and also stems from one of their "best practices":
If a given card has too many widgets, it can fill too much of the screen and become less useful. While large card sections render as collapsable UI elements, this hides information from the user. Aim to streamline your add-on and provide exactly what the user needs and no more.
With multiple text inputs on a single line, the display could become extremely crowded when viewing the add-on from a mobile device, even if it is still comfortable when viewed via desktop browser. Limitations on side-by-side layout are not unique to TextInputs. Other "side-by-side" widgets such as a Key-Value will not allow setting both a Button and a Switch.
Consider reviewing the available widgets on the Widget overview - images on the page detail the appearance of a wide variety of widgets and you may find something more suitable.
Alternately, consider creating a Feature Request for this functionality, or reviewing the existing Feature Requests in Google's Issue Tracker
Semi-related existing questions:
Any way to show two widget side by side in gmail add on?
How to create this UI in Gmail Add-on using Google Apps Script

Autodesk Viewer: Show a list of elements with specified Database IDs

The functionality I seek is very similar to the default ModelStructurePanel model browser, except that I need to list only a subset of elements, by passing a list of dbIds of the elements I want listed. By clicking on an element on that list, have the view focus on that element.
I figure there might be two ways of achieving this by using the ModelStructurePanel (although I'm open to using something else):
Creating a new instanceTree with only the specified elements, then doing something like viewer.modelstructure.setModel(newInstanceTree)
Overwriting the ModelStructurePanel.shouldInclude method to hide all elements but the specified ones.
I have googled for Viewer code boilerplate that would provide this functionality, but have not found it. Any help is very much appreciated.
There is a basic sample here very close to what you described, and I would go with customizing just one action instead create a new one, seems easier.

How can increase the calendar size in Access?

I am polishing up an Access form, and I would like to increase the calendar selection panel because some people can't see it properly:
Thank you very much for your time!
It looks like you're using the built-in DatePicker option in Access. Unfortunately this component is not customizable. However, you could suppress the use of the DatePicker and instead use a custom calendar form (as a subform on your main form). This would provide you with the flexibility to make the calendar as large as you need it to be for your users.
This isn't a trivial task, but there is a GitHub repo that contains a calendar form and a sample form illustrating how to incorporate the calendar form into an application. (You may need to customize the size of the calendar form for your particular use case, but the "hard part" of writing the calendar functionality has already been done).
The repo with the sample can be found here: https://github.com/OfficeDev/Office-Access-Replace-Calendar-Control