Hey everyone,
So, im new here and fairly new to coding in general. But im trying to set up a rule so that i can eliminate quite a bit of up front end work on excel documents we get in monthly for a mailing.
The short version is, as an example, i have a pdf with 2 pages and there are three graphic frames, one on page one and two on page two. What i need to do is place a graphic based on a number from column p1 (1-14) in frame 1, then when that is done, move to frame 2 and pull a number from column p2 (1-14) then move to frame 3 etc...
the tricky part is that if p2 is empty, i need to pull from a different column, protocol. And that will be a if its this number use this graphic else use this graphic.
the same will apply, if p1, and p2 have values, and p3 is blank, i need it to switch too the protocol program.
So the other tricky thing i need is that if p2 pulls from protocol, i need p3 to be blank, so it doesn't place the protocol graphic twice.
This is the code i have now. Which i know is not right, but i wanted to have a base to build on. The red is basically just want i want to happen where i imagine it needs to happen.
//if there is an entry in P1 return corresponding resource- (this is working right now)
if (Field("P1") == 1)
{
return Resource("Heart disease1.pdf");
}
else if (Field("P1") == 2)
{
return Resource("Heart failure2.pdf");
}
// This second set of code is for the second graphic frame, not the first.
// so basically i need the rule to read the above code for "frame 1"
// then the code below to apply to "Frame 2".
//Once "frame one" is full, move to "frame two", then Move to "frame 3" //when frame 2 is full. etc..
if (field("P2") == 3)
{
return Resource("Breathing3.pdf");
}
//Frame 3
if (field("P3") == 4)
{
return Resource("Kidney4.pdf");
// Then, if P2 or P3 is blank. I need the rule to pull from the Protocol column and insert one of two files.
if(field("P2") == null))
&& (Field("PROTOCOL") = 704)
{
return Resource("Closing letter15.pdf");
}
else if (Field("PROTOCOL") = 712) {
return Resource("ClosingLetter16");
}
// Then i need the rule to determine that if P2 has the last insert(P3 is blank). Then it should stop, and not insert anything into "frame 3"
Any help would be great!
Thanks
Jason