Inline data from Data Sheets in text blocks

Hello World.

It seems like it should be possible to use something like “$slot(‘slot name’)” within a text block to incorporate data into that text. For instance, with the chat app, being able to have the field say “You have sent $slot(‘ds_TotalMessagesSent’) chat messages.” Is that already functionality somewhere here? Thanks.

Hi Jeff. Yes, you can add a script for the text block to get what you’re looking for.

The script would look something like:

let TotalMessagesSent = this.props.appActions.dataSlots[‘ds_TotalMessagesSent’];

input = ‘You have sent ’ + TotalMessagesSent + ’ chat messages.’;

return input;

Oh sweet. Thanks! Is there, by chance, a way to reference a carried property? My other usecase involves a certain line in the data sheet, but that’s kind of hard to reference in code. Have a great day.

You can access any datasheet with:
var db = this.props.appActions.dataSheets['exampleSheet'].items;

This returns a list of rows which you can then make use of as needed

or if you have a carried row from a datasheet, you can usually access it with this.props.dataSheetRow

1 Like