A unique column in the Foundry system that utilizes function-backed technology to calculate the monthly usage of engines over a

In my dataset of ‘Engine Hours’, I have the following information:

Engine# Date Recorded Hours
ABC123 Jan 21, 2024 9,171
ABC123 Dec 13, 2023 9,009
ABC123 Oct 6, 2023 8,936
XYZ456 Jan 8, 2024 5,543
XYZ456 Nov 1, 2023 4,998
XYZ456 Oct 10, 2023 4,002

In another set of data for ‘Engine’, I display the latest Engine Hours in a Workshop Object Table by linking it to the 'Engine Hours' objects with an aggregation on the property 'Maximum' to show the most recent recorded hours.

Engine# Date Recorded Latest Hours
ABC123 Jan 21, 2024 9,171
XYZ456 Jan 8, 2024 5,543

Now, I am looking to add a column that shows the average monthly usage over a rolling 3-month period. I believe this can be achieved using a Function-Backed Column, but I lack the knowledge of TypeScript to create it myself. I have tried searching for similar examples within Palantir Learning resources and online, but haven't found a solution yet.

Does anyone have a template or example code for a similar Function-Backed Column that I could use for this specific case?

Thank you!

Answer №1

To support a derived column in an Object Table within Workshop, you would typically require a Function.

Here is a demonstration of how this can be achieved by dividing the logic into two separate functions:

  1. The first function operates on a set of objects and generates a mapping between each object and the calculated value (e.g., the average over the last 3 months).
  2. The second function computes the desired value for a specific object.

There are several benefits to utilizing this approach:

  • You can utilize the second function to populate various widgets (such as a Metric Card) by simply passing an object and retrieving the corresponding value without duplicating the logic.
  • The parallelization of Function 1 using Promises/asynchronous computation enables efficient processing.

Limitations:

  • Standard enforced limits apply to any applied function, including constraints on memory load (maximum of 100k objects) and compute time (max of 30 seconds).
// Necessary imports...
/*
* 1/ This function returns a "FunctionsMap", acting as a map linking object instances
* with the display value in the derived column for each instance
*/
@Function()
public getDerivedColumn(myEngines: ObjectSet<Engine>): FunctionsMap<Engine, Double>{
    // Implementation details...
}

/* 2/ Function for calculating value for a single object */
@Function()
public async computeMetric(currentEngine : Engine): Promise<Double> {
    // Implementation details...
}

Please note that while this code snippet has not been tested extensively, it should closely align with your requirements.

Additional information on function-backed columns in Workshop

Answer №2

If you're looking to utilize the pipeline builder tool for incorporating data into the Workshop module dashboard, it can be easily accomplished.

You'll come across the average functionality within the tool, requiring some basic mathematical operations in the pipeline builder to prepare the data accordingly.

If you require detailed guidance on navigating this process through the user interface, feel free to reach out. It's designed to simplify management and comprehension of tasks.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Steps to extract a hash from a document's URL

The following code is used: jQuery(document).ready(function() { console.log($(this)); }); After running this code, the object displayed in the console is: [Document mypage.html#weather] How can I retrieve the last ID from this object? In this ...

How to disable React Native yellow warnings in console using npm

Is there a way to get rid of those pesky yellow warnings flooding my npm console? It's becoming impossible to spot my own console.log messages amidst all the warning clutter. https://i.stack.imgur.com/JAMEa.jpg I've already attempted the follow ...

Is Angular File API Support Compatible with HTML5?

When checking for HTML5 File API browser support in my code: private hasHtml5FileApiSupport; constructor(@Optional() @Inject(DOCUMENT) document: Document) { const w = document.defaultView; this.hasHtml5FileApiSupport = w.File && w.FileReader & ...

Attempting to remove an attribute or property in JavaScript will not yield the desired result

When I try to close the menu after opening it, the inline style won't get removed despite trying different methods. The CSS only has text properties for alignment and the class can-transform contains a media query. That's all the information I h ...

Angular 7: Show selected value upon clicking Radio button

I am having an issue with a radio button where I need to display a value when it is clicked. For example, when the "weekly" option is selected, I want it to display "Weekly" in the "Selection" element. I have tried to implement this but it is not working a ...

JavaScript: Responding to the fetch response based on certain conditions

I am currently working with a fetch() request that can either return a zip file (blob) or a JSON object in case of an error. The existing code successfully handles the zip file by sending it to the user's Downloads folder. However, when a JSON respons ...

Issue resolved: Mysterious fix found for background images not displaying in NextJS React components

I am having trouble displaying a background image on an element in NextJs using Typescript and Tailwind. I do not believe it is a TypeScript issue since I am not receiving any errors or IntelliSense warnings. Below is the code I am working with: var classn ...

Display the information from a JSON array using an alert box

Similar Question: How can I access a specific value in a nested data structure or JSON? I am trying to display data from a JSON array using the following code, but it is not working: var Content = [{ "01":[{"text":"blablablablabla","foo":"abeille ...

Merge the values of an object's key with commas

I'm dealing with an array of objects that looks like this: let modifiers = [ {name: "House Fries", price: "2.00"}, {name: "Baked Potato", price: "2.50"}, {name: "Grits", price: "1.50"}, {name: "Nothing on Side", price: "0.00"} ] My goal is to con ...

Creating a modal dialog using a function in a TypeScript file

Hey there, fellow developers! I have a question that might seem simple. So, in my HTML code I've got a Modal Dialog that pops up using ng2 Bootstrap. It's working fine, but... I want to replace this line of code "<button class="btn btn-prim ...

Tips for effectively adjusting lighting in a customized shader material

Presenting a demonstration showcasing the use of a height map in three.js coupled with custom shader(s). Everything appears to be functioning smoothly now. The working demo can be found on this link. Below are the shader scripts: <script id="vertexShad ...

Issue with redirect after submitting CakePHP form not functioning as expected

I am in the process of developing a button that will submit a form and then redirect to another page. $('#saveApp').click(function() { event.preventDefault(); $("form[id='CustomerSaveForm']").submit(); // using the nati ...

Utilizing React Native Camera Kit allows for the seamless and continuous scanning of QR codes, offering multiple callbacks when a code is

Attempting to integrate a QR code scanner into my project using react native. Utilizing the plugin react-native-camera-kit, which supports both QR and Bar code scanning. However, I am facing an issue where the scanner continuously scans the code and trig ...

Printing the selected value from a drop-down box in HTML with JavaScript

I'm in the process of creating a web page structured like this: <html> <head> <title>Bug UI</title> </head> <body> <script> function myfunc() { //what should I include here?? } </script> <form> ...

Efficiently integrating Firebase Functions with external sub path imports beyond the project's

I encountered an issue in my firebase functions project with typescript. The problem arises when I use types from outside the project with sub path imports, causing the build files to become distorted. Instead of having main:lib/index.js, I have main:lib/ ...

Alter the default time zone in JavaScript

PHP features a function known as date_default_timezone_set which impacts the GMT time that is used by the Date() command. Is there a way for this function to also impact JavaScript? Here is a custom function I have: function calcTime(offset) { d = n ...

Leveraging regex match.map to incorporate a React <img> tag within a given string

One of my recent discoveries involves replacing a string completely with React image elements, as demonstrated in the following code snippet: if (source.match(/\{([0-z,½,∞]+)\}/g)) { tagged = source.match(/\{([0-z,½,∞]+)\ ...

Original: Generic for type guard functionRewritten: Universal

I have successfully created a function that filters a list of two types into two separate lists of unique type using hardcoded types: interface TypeA { kind: 'typeA'; } interface TypeB { kind: 'typeB'; } filterMixedList(mixedList$: ...

Fetching a collection from Cloud Firestore using Angular and Firebase

I'm looking to figure out how to retrieve lists from cloud firestore. Here is how I upload a list : export interface Data { name: string; address: string; address2: string; pscode: string; ccode: string; name2: string; } constructor(pri ...

Utilizing Async and await for transferring data between components

I currently have 2 components and 1 service file. The **Component** is where I need the response to be displayed. My goal is to call a function from the Master component in Component 1 and receive the response back in the Master component. My concern lies ...