Forum Discussion
If one source returns an error use other source
- 4 years ago
Hi CannoK ,
Not sure what you mean by "it's not following up with any of the other steps". Your code doesn't tell PQ to perform any steps if Bron2 is used, except for the AlternativeExpand step.
You will need to restructure your query a bit. It should be something like this:
let Bron1 = Bron1source, Xforms1 = All transformation steps to do if Bron1 is source, Final1 = The final output step using Bron1, Bron2 = Bron2source, Xforms2 = All transformation steps to do if Bron2 is source, Final2 = The final output step using Bron2, TestForError = try Final1, Output = if TestForError[HasError] then Final2 else Final1 in OutputPete
- 4 years ago
CannoK ,
Cool, glad it looks like it will work for you.
I think this can be slightly optimised if you are performing exactly the same transformations whether using Bron1 or Bron2, with a structure like this:
let Bron1 = Bron1source, Xform1 = First transformation step to do if Bron1 is source, Bron2 = Bron2source, Xform2 = First transformation step to do if Bron2 is source, TestForError = try Xform1, Output = if TestForError[HasError] then Xform2 else Xform1 genericXforms = steps to perform on either source, using Output step as first argument in first function, genericFinal = Final step of generic xforms in genericFinalPete
- Anonymous4 years ago
You sure can, like
try Bron otherwise try AlternativeBron otherwise try thisOtherSource otherwise LastSource
---Nate
Hi Anonymous ,
I see how that could work maybe even better yes. Is it possible to do multiple otherwise statements? I'm trying to make it work for 3 or more datasources.
You sure can, like
try Bron otherwise try AlternativeBron otherwise try thisOtherSource otherwise LastSource
---Nate
- CannoK4 years agoNew Member
**bleep** that is cool. It works like a charm. Thanks a lot man.