Relationship Query ??? Legacy to AMD

Discussion created by BritishSteel on Oct 17, 2013
Latest reply on Oct 24, 2013 by BritishSteel
Hi everyone,

I am trying to use a relationship query in my application. About 5 months ago I had never used HTML, CSS or JavaScript, so I am very dependent on the provided samples. The only provided AMD sample has a lot of additional stuff and gets complicated quickly for me, and therefore I have tackled a legacy sample ??? I even get it to work. Translating the script into AMD is my next step, but it turns out to be harder than expected.

OK, so I have reduced my 600-line code to about 200 lines. Once I get that working I will add the previous stuff again. I am attaching two scripts, the first one (QueryRelatedWORKING) is in legacy mode and it is able to correctly query my table (click on a parcel ??? display a table). If I had a one-to-one translation of that script into AMD I would be more than happy. The second one (QueryRelatedTRANSLATE) is my attempt to translate into AMD. Viewing both codes next to each other is perhaps the easiest way to detect problems.

I added //OK to lines in the original script that I am pretty sure I translated correctly. If I was unsure, ran into issues, or have questions I left a comment saying so.

My biggest issue (and maybe solution to a lot of it) is that I am not sure where to import things in the beginning statements before you start coding. What I mean is :

function(Map, a, b, c){
var map = new Map
var ??? = new a
var ??? = new b

etc. etc.

The way it works, I read, is that you have to mention things in the correct order. Which is fine in a simple application but once it gets complicated that becomes impossible for a beginner, especially when dojo is thrown into that (which I am not familiar with). For example, what happens if I use things twice? And where do I put the dojo stuff? Can I mix dojo, dijit, and dojox? Looking at samples I???d say I need to put the esri stuff first and then the dojo stuff, but ordering within dojo becomes complex quite fast.

Again, I am a beginner so please point out even the most obvious mistakes. Any advice and correction is greatly appreciated :)

PS: I???d be happy to post both scripts in here as well, but if I remember correctly from what I read a while ago one should not post long codes.