Record List to CSV

Record List to CSV



I'm trying to convert a list of UserIds within a client action into CSV, to be used in an SQL widget in a server action.

In the client action I have an Aggregate to collect the list of UserIds required. I've assigned these to a Variable of User Identifier List type. I think that part is correct for storing the list?

From here I've tried two things:

1) Assign to a text type variable "UserIdCSV":  If(UserIdCSV <> "", ",", "") + UserIdList.Current

This seemed to work but only collected one of the UserIds. Not sure if I need a For Each widget in there somewhere?

2) I've downloaded the CSV xif from here. The record list input parameter for this is Object type. Within the client action I tried assigning a new object type variable with ToObject(aggregate.list) prior to passing to the server action holding the CSV action (then obviously assigned the output to a text type variable). This looked like it would have worked but came up with errors when trying to test the application: "Request failed with status 400" and "Failed to parse JSON request".

I figured out that these error were caused my my initial ToObject assign. Not sure what was happening there?

Can anyone shed some light on where I may be going wrong in order to take a simple list of IDs from an aggregate and pass them into a text variable as CSV?


Please provide with an oml what you are trying to do.

Furthermore, if it's just a small list of userid's I would suggest to use stringJoin action from the text.xif and make your life a bit easier.

I hadn't heard of the text.xif or string_join action. I just tried it then, my variable is User Identifier List type but the StringJoin action wants a text record list.... how do I convert that?

I could upload an OML but being a rookie it's got a million other things in it (very hard to follow). I'd have to make a new one to make it simpler.

make an advanced query with a strcuture of Text as output..

Sorry, I'm trying to take the list of UserIds from a local entity in a phone app and pass this list to a server action to use this list in a query on the server side entities. I can't use an advance query in local client action.

well, a simple for-loop and append those id's then?

Ok I finally figured out what I was doing wrong. 

Where I had previously had: [If(UserIdCSV <> "", ",", "") + UserIdList.Current], I actually needed to have [
If(UserIdCSV <> "", UserIdCSV + ",", "") + UserIdList.Current] along with a For Each action. I've verified this is giving me a text string of Ids to be used in an SQL.

The next issue I've run into is that within the SQL I am searching for UserId in (UserId CSV) which bring up error for converting the data type. Obviously there's a data mismatch between me searching the User Identifier type by using a text type variable. There are functions such as IntegerToIdentifier() which I believe may help, but how do I use this within the SQL?

I've created a basic .oml file replicating what I am trying to achieve. Only two screen, one to set who your favourite clients are, and 1 which should show all clients, or only favourite clients with a 'toggle' button.
If I need to explain further please let me know. 


set  expand-inline to true in your advanced query!

and the left adv. query, instead of 'False' and 'True' simply do 0 and 1


Perfect, that got it working. Thanks for your help!