Post

3 followers Follow
0
Avatar

Creating a list from a referenced app

Hi guys, 

A quick question as I'm sure you'll know this one.

I'd like to use a calculation to list the status followed by a text field in a related app.

The main app is the products app which is related to an app called document control. Within document control, each product can be related to a number of document types.

In the document control app, the 2 relevant fields are:

Status: types (User guide, Quick start guide, Software guide)

Text field: version (i.e. user guide version: 1.0.2)

So in the product app, I want to create a calculation field that can list these related fields for each product like this:

  • User guide: 1.0.2
  • Quick start guide: 1.3
  • Software guide: 3

I've tried using @all of.join() but that just returns a list like 1.2,2.0.3

Any help would be much appreciated.

Jeremy

 

 

Jeremy Caunt

Please sign in to leave a comment.

2 comments

1
Avatar

Hi Jeremy,

this should work:

var status = @All of Status;
var version = @All of version;
var lines = [];
for(var i = 0; i < status.length; i++){
lines.push("- **" + status[i] + "**: " + version[i]);
};
lines.join("\n")

For this code it's important that in all Document Control items both fields (status and version) always are filled. 

Another way: 
In Document control  add a (hidden) calculation field:, name it e.g "List line":

"- **" + @Status + "**: " + @Version 

And then in the Products App:

@All of List Line.join("\n")

Rainer

Rainer Grabowski 1 vote
Comment actions Permalink
0
Avatar

Hi Rainer, 

Thank you so much that's perfect, exactly what I needed.

You are indeed the Java Jedi..!

Jeremy

Jeremy Caunt 0 votes
Comment actions Permalink