8 Replies Latest reply: May 15, 2014 10:07 AM by drobert _ RSS

    Change field names on the fly

    drobert _

      I have a report which can be in English or French that I extract the data from and create a PDF, but unfortunately the field names that I created may not be suitable for the language that the report was originally written in.

       

      I thought that a solution would be to create another set of fields named for the other language and that they would be able to selectively hidden/unhidden depending on the laguage found on the report, but I was not able to find a way of doing this.:confused:

       

      As a last resort I could create two models and choose the one I need, but I would rather not have to take care of two models to do the same thing.

       

      Can this be done?  Is there another way to accomplish this?

        • Change field names on the fly
          Data Kruncher

          Yes, technically it can be done (but not in a single model, unless another forum member wants a challenge that needs a really creative solution :confused:), but honestly you're probably better off just making two models.

           

          One way that I'd envision would be to have a single record CSV file for the English headings, and another for the French headings. Run an English batch file to copy the English names to a new file, then run a Monarch project set to append to the same file without including any field names. Now open the "completed" CSV file as a database source, and output/filter/sort/summarize as necessary.

           

          Do the same for a French batch file, replacing the English heading record with the previously created French heading record.

           

          Like I said, make two models.

           

          Maybe it would be more worthwhile if you needed more than two languages, but probably not.

          • Change field names on the fly
            Olly Bond

            Hello drobert,

             

            I think this could be done (mercifully we don't have to use all three official languages at work so I've not needed to implement this). Let's assume that there's a way to detect the language of the report from some text in the page header of the first page. Along with all the other templates, trap this as an append so it's present on every row of data, use a calculated field to convert this to "en" or "fr" as required.

             

            Create a filter called "en", and one called "fr" based on this. Create a project export based on "all filters" of the table data with export filenames based on filter names. Now you have two datasets, one of which will be empty, and you can use two models, one which maps the field names to French ones, and these can be run against the known filenames from the exports of the first project.

             

            HTH,

             

            Olly

              • Change field names on the fly
                Grant Perkins

                Daniel,

                 

                Have you looked at the possiblity of using Linked Objects for creating a second model?

                 

                I'm wondering whether you could, in effect, have a second version of the model completely, or almost completely, maintained by changes (when required) being applied only to the 'Master' model.

                 

                It's just an idea at the moment. However you have a sample report/models/(spec(s)) that you are using to develop a solution and you can share them with others I would be happy to take on a challenge to see how much could be achieved.

                 

                I would rather work with a 'real world' challenge than try to make something up only to find that it is an incomplete solution to an incomplete problem!

                 

                 

                Grant

              • Change field names on the fly
                Nigel Winton

                Depending on what and how much you are exporting, but could you use summaries. Two identical ones with the field names changed as approrpiate. Then all you need to do it set up a couple of Project Exports and choose which one you need to use.

                I have done something similar when different people needed to see specific column headers for the same thing. The limiting factor is what you need to export in the way of data.

                 

                Regards

                 

                Nigel

                • Change field names on the fly
                  Nigel Winton

                  Just wondering if you could use summaries. Set up the first for English, duplicate it and change the field titles to French.

                  Then set up 2 project exports, and then choose which one you need to use.

                  Depending on what and how much data you have this could work and if you ever needed to export the English original in French you could.

                  I have done something similar when 2 users needed different column headings for the same data.

                   

                  Regards

                   

                  Nigel

                    • Change field names on the fly
                      drobert _

                      Wow, thanks for all your different and great ideas:D.  I will mull them over and try them and see what is best for my situation.  I will let you know what I have used.

                        • Change field names on the fly
                          drobert _

                          I have decided to try Nigel's suggestion as it seemed to fit what I was trying to do. Of coarse, this brings another question:rolleyes:.

                           

                          I created a hidden calculated field to indicate which language the report is in. I used this field to determine that if it's the appropriate language for the summary (one is English and the other French, yeah really:rolleyes:) by using it in a filter. So one summary has no data and the other has the output I wanted.

                           

                          I created a project file from my model and created two Project Exports for the two summaries I created. The problem is that when I try to create the PDF from the command prompt, I get two of them, but one is actually blank (Adobe complains that it has no pages) but the file is not empty (not zero bytes).

                           

                          Here is the command I use:

                          start monarch /rpt:"rptpath\datafile.txt" /prj:"Report Extract.xprj" /px:French /px:English[/code]

                           

                          Since I really don't know the language of the report from the command prompt, I thought that I would be able to tell by seeing which file is created, but as explained above, both are created. How would I be able to get it to not create the output file if there is not data, other then getting fancy with Windows command line or using VBS?

                            • Change field names on the fly
                              drobert _

                              What I did in my batch file was to do a "find" in the report file to see if a certain word was in a certain language (Rapport/Report) so after that I knew which Project Export to use; in fact that is the same region of the report that I use to determine the language used in by filter.

                               

                              Thanks everyone for their suggestions.:D