Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %dw 2.0
- output application/json
- import training::dw::Utils
- var fieldMask = [
- "openFlightsAirportId",
- // "airportName",
- // "city",
- "country",
- "IATA",
- " ICAO",in fact
- // "longitude",
- // "latitude",
- // "altitude",
- "timeZone",
- "DST",
- "timeZone",
- "type",
- "source"
- ]
- var airportInfo = Utils::safeRead("localdata/airportInfoTiny.csv","application/csv")
- groupBy $.IATA
- fun getAirportInfo(ac:String) =
- airportInfo["$(ac)"][0] -- fieldMask
- fun embedAirportInfo(flights) =
- flights map (f) ->
- (f - "destination") ++
- destination: getAirportInfo(f.destination) ++ designation: f.destination
- fun objectArrayToXml (a:Array<Object>,t:String) =
- (dw::core::Strings::pluralize(t)):
- {(a map (f) -> (t): f)}
- var joinedInfo = embedAirportInfo(payload)
- ---
- embedAirportInfo(payload)
Add Comment
Please, Sign In to add comment