Print queries to PDF

Hi guys…! Someone who knows how to print query results in pdf, either through react or some other library, is it possible to create a dynamic query with FQL and then print its result in pdf?

I have tried to print to PDF using reactPDF but it is not a very FQL friendly solution

Any help would be nice!!

Hi @adinjesuha,

First, welcome back to the Fauna forums!

Can you share a code example of what you’re doing with reactPDF and why you say it’s not FQL friendly? That might help give some context around what you’re trying to do, and allow some of the React experts in the community to better sort out some options for you.

Cory

Hi @Cory_Fauna thanks for your help!

I will give you a context of what I want to achieve… I have an FQL function that what it does is bring the results with different dynamic parameters:


const matches = [];
if(param1) matches.push(Match(Index("ejemplares_ref_by_param1"), param1));
if(param2) matches.push(Match(Index("ejemplares_ref_by_param2"), param2));

Let(
 {
   match: If(
     And(dateRangeOne, dateRangeTwo),
       Intersection(
         Join(
           Range(
             Match(Index("ejemplares_ref_by_dateRangeOne")),
             [dateRangeOneInit],
             [dateRangeOneEnd]
           ),
           Lambda(["value","ref"], Match(Index("ejemplar_values_by_ref"), Var("ref")))
         ),
         Join(
           Range(
             Match(Index("ejemplares_ref_by_dateRangeTwo")),
             [dateRangeTwoInit],
             [dateRangeTwoEnd]
           ),
           Lambda(["value","ref"], Match(Index("ejemplar_values_by_ref"), Var("ref")))
         ),
         Join(
            Intersection(matches),
            Lambda(["data", "ref"], Match(Index("ejemplar_values_by_ref"), Var("ref")))
         ),
       ),
       If(
         dateRangeOne,
         Intersection(
           Join(
             Range(
               Match(Index("ejemplares_ref_by_dateRangeOne")),
               [dateRangeOneInitInit],
               [dateRangeOneInitEnd]
             ),
             Lambda(["value","ref"], Match(Index("ejemplar_values_by_ref"), Var("ref")))
           ),
           Join(
             Intersection(matches),
             Lambda(["data", "ref"], Match(Index("ejemplar_values_by_ref"), Var("ref")))
           )
         ),
         If(
           dateRangeTwo,
           Intersection(
             Join(
               Range(
                 Match(Index("ejemplares_ref_by_dateRangeTwo")),
                 [dateRangeTwoInit],
                 [dateRangeTwoEnd]
               ),
               Lambda(["value","ref"], Match(Index("ejemplar_values_by_ref"), Var("ref")))
             ),
             Join(
               Intersection(matches),
               Lambda(["data", "ref"], Match(Index("ejemplar_values_by_ref"), Var("ref")))
             ),
           ),
           Join(
             Intersection(matches),
             Lambda(["data", "ref"], Match(Index("ejemplar_values_by_ref"), Var("ref")))
           )
         )
       )
     ),
     size: limit ? parseInt(limit, 10) : 20,
       after,
       before,
       page: If(
         Equals(Var("before"), null),
           If(
             Equals(Var("after"), null),
             Paginate(Var("match"), { size: Var("size") }),
         Paginate(Var("match"), {
           after: Var("after"),
           size: Var("size")
         })
       ),
       Paginate( Var("match"), {
         before: Var("before"),
          size: Var("size")
        }
      )
    ),
  },
  Var("page")
)

As you can see it’s a big query based on multiple user options, I want a preview results (manage with pagination) and also I need to print the complete results (results may vary from 100 to 10000) to a PDF document.

I hope this can help you better understand what I’m trying to achieve.

Thanks guys!