Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

organise an array

Hi,
I have an array which I am sending with sendgrid, all works well, but my array is not very user friendly,

Is there something that can be done with the array before its sent with sendgrid.

Remove brackets and quotes?

but more importantly a line break at the mark on the screenshot below

thx

Image

Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

organise an array

Hi Michael,

Please give us a public link, this should be working.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

organise an array

Hi Katya,
here is the link Login and pass "a" the app is shared "star pizza"
to send email click checkout from vegetarian pizza screen and click order button at bottom to send email, you will need to add an email address in the input

this is the code for the email content I have used below

cheers

http://appery.io/app/mobile-frame?src...

Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

organise an array

Michael,

If you need to display an array in a usual view then you can process it as you want. For example display parameter 'Base' in console (then you can do what you need):precodevar arr = JSON.parse(liveorderArray);
$(arr).each(function(e){
console.log("Base = " + arr[e].Base + "\n");
});/code/pre

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

organise an array

Katya,
sorry I dont follow, where do I use this code?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

organise an array

Hi Michael,

You should paste it instead:prevar liveorderArray = localStorage.getItem("liveorderArray") + "\n";/pre
codeconsole.log()/codewas only an example. You can output data as you want. If there are any difficulties you can send us a text you want to get as a result.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

organise an array

Hi Katya,
from the array I would like it to appear in the email like the example below

"[{"Pizza":"Margarita","Size":"Twelve Inch Stuffed Crust","Base":"Deep Base","Price":"6.50"},{"Pizza":"Hot Vegetarian","Size":"Twelve Inch","Base":"Deep Base","Price":"6.00"}]"

example

Pizza : Margarita , Size : Twelve Inch Stuffed Crust , Base : Deep Base , Price :6.50 Pizza : Hot Vegetarian , Size : Twelve Inch , Base : Deep Base , Price : 6.00

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

organise an array

Michael,

Would you like it to appear this way?prevar liveorderArray = localStorage.getItem("liveorderArray");
liveorderArray .replace(/[[]{}]/gi,"").replace(/"/gi," ").replace(/ ,/gi,",");/pre

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

organise an array

Hi Katya,
this is how it appears in my email, and this is the code implemented

Image

Image

I am trying to get it to appear like this

Pizza : Margarita , Size : Twelve Inch Stuffed Crust , Base : Deep Base , Price :6.50 Pizza : Hot Vegetarian , Size : Twelve Inch , Base : Deep Base , Price : 6.00

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

organise an array

Sorry, there was a typo, please replacepreliveorderArray .replace/prewithpreliveorderArray.replace/pre

Return to “Issues”