0

I'm working on a calendar roster system for work. Unfortunately most solutions/plugins aren't ideal for what I want.

Anywho, what I was wondering is if it possible to select a value from an array output in JSON format, based on multiple criteria. I am using jQuery

to put it fairly generically (haven't started coding it yet):

<for each cell>
--<find ['number_of_slots'] in JSONarray where ['AppointmentDate'] = "02/02/12" && ['salespoint'] = 1 && ['AppointmentTime] = '10AM'>
--<if no results>
-----<fill cell with 'x'>
--<else>
-----<fill cell with ['number_of_slots']
--<end if>

Or am I better off making an MySQL query for each cell? Just seems to be quite a number of transactions, that's all.

As always, any help and advice is greatly appreciated!

Cheers!

2
  • Is manipulating the data as javascript object than parsing it to jSon acceptable? Commented Jan 8, 2012 at 1:12
  • I'll be honest, I'm not sure how I'd accomplish that. The JSON is provided by PHP from a MySQL database. Commented Jan 8, 2012 at 1:25

1 Answer 1

0

If manipulating the data as javascript object than parsing it back to jSon is acceptable:

Parse it to js object: http://api.jquery.com/jQuery.parseJSON/

Parse it back to jSon to String: http://api.jquery.com/jQuery.param/

Parse to jSon issue discussed Convert Object to JSON string

Not the answer to your question but a solution with jQuery, though

Sign up to request clarification or add additional context in comments.

2 Comments

Well if I'm able to replicate a MySQL SELECT statment on that object, then, sure. Do you know if this would be the case?
Well, you should be able to. Since the jsToJson Parser works in a certain way you can always manipulate the js input in a manner that you reach the desired output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.