Greek (NA28): Πᾶσαν χαρὰν ἡγήσασθε, ἀδελφοί μου, ὅταν πειρασμοῖς περιπέσητε ποικίλοις, γινώσκοντες ὅτι τὸ δοκίμιον ὑμῶν τῆς πίστεως κατεργάζεται ὑπομονήν.
After his greetings to the "twelve tribes of the diaspora," James urges his readers to consider their variegated trials Πᾶσαν χαρὰν which is an accusatival phrase modified by ἡγήσασθε (first aorist middle imperative of ἡγέομαι). F.J.A. Hort contends that Πᾶσαν χαρὰν not "every (kind of) joy," but rather all joy "as expressing completeness and unreservedness" (The Epistle of St. James, page 3). A.T. Robertson adds that James is talking about "whole joy" or a joy that is unmixed, not mingled with some joy and some grief.
ἀδελφοί μου-vocative plural nominative + genitive. James employs ἀδελφός metaphorically with the referent being fellow Christians (Abbott-Smith).
ὅταν-Robertson seems to prefer "whenever" here: he identifies the word as an indefinite temporal conjunction. Hort points out that ὅταν has frequentative force: "whensoever ye shall."
πειρασμοῖς περιπέσητε ποικίλοις-"when you encounter (meet with) various trials." Thucydides writes: τοιούτῳ μὲν πάθει οἱ Ἀθηναῖοι περιπεσόντες ἐπιέζοντο (History 2.54). See Luke 10:30; Acts 27:41.
γινώσκοντες-present participle active nominative masculine singular of γινώσκω.
ὅτι τὸ δοκίμιον ὑμῶν τῆς πίστεως-compare 1 Peter 1:7.
κατεργάζεται ὑπομονήν-Robertson writes:
Worketh (κατεργάζεται). Present (durative) middle indicative of the compound verb with the perfective sense of κατα as in Philippians 2:12, which see.
Patience (ὑπομονήν). Old and common word for remaining under (υπομενω), "staying power" (Ropes), as in Colossians 1:11.
Compare Romans 5:3: οὐ μόνον δέ, ἀλλὰ καὶ καυχώμεθα ἐν ταῖς θλίψεσιν, εἰδότες ὅτι ἡ θλίψις ὑπομονὴν κατεργάζεται
Romans 5:2-5, James 1:2-4, and 1 Peter 1:6-7 structure arguments in similar fashion by linking statements together through concatenation.