-
Report Building with BFormat
Alright folks. I've noticed recently I'm being sent to more and more network wide communication issues. In my desire to get this handled more efficiently I thought it'd be nice to have a report page that I could see the Last Ok and Last Fail times for the units added to the report.
However Im struggling to figure out a way that these can be brought out and used for a report.
Ive attempted to try and create points under the controller and link Health to them but this didn't seem to be feasible because these points under the Health point in the Property Sheet isnt available to link. I would like to avoid having to do custom programming to hold onto the last times that the controllers fail a SendRequest.
I also have tried to figure out what the BFormat text would be to grab this data but Im striking out. I havent been able to find any really good documentation on BFormat examples. Feeling like this is one of those parts of Niagara where the help docs are lacking in comparison to whats possible with BFormat.
Theres a chance that what Im trying to accomplish cant be done without programming being made in Niagara but I figured Id shoot my shot with the community here.
-
-
Maybe try something like this, bql:select toString as 'Health' from driver:PingHealth where displayName = 'Health'
Go Rangers!
-
Oops, forgot to add the parent to see the controller names, bql:select parent as 'Unit',toString as 'Health' from driver:PingHealth where displayName = 'Health'
Go Rangers!
-
Post Likes - 1 Likes, 0 Dislikes
-
Was working on typing this up to answer my own question
Thank you for the suggestion though!
Hopefully this will help someone troubleshooting comms click a few less buttons.
So after much digging and trial and error. (5hours of BFormat failures) I was actually able to come away with the answer.
I tried to post images below but Im still a n00b sooo...this will have to do.
Was able to find a Doc file that had a lot of BFormat commands for health related actions. Also posted below.
local:|module://docDeveloper/doc/driver-rt/javax/baja/driver/ping/BPingHealth.bajadoc
The commands %health.getLastOkTime% and %health.getLastFailTime% ended up being my saving grace.
I have no intentions of making it pretty. I just want to be able to deploy this report quickly because inter-mitten comm issues make me nuttier than squirrel
-
Post Likes - 2 Likes, 0 Dislikes
-
Thank you for this post! If I could bug both "letsTryThis" and "lwarren" for a bit more info I would really appreciate it.
letsTryThis:
I looked at the help file for the module you gave above and was wondering how you went from the that help file to knowing to use %health.getLastOkTime%. Specifically how did you know "health part??? I mean I know method part to use the "getLastOkTime", but how did you connect the "BPingHealth" part the "health.METHOD"????? Also, how did you know it would be usable in a BFormat string and not as an argument in a BQL query?
I tried doing a search in the help files on the string %health.getLastOkTime% and it gave me the module you indicated in the path above and it also gave me a result of the BPingHealth.java file, however, that java file does not exist anywhere on my installation that I can find. I even searched the AX directories and it wasn't there.
lwarren:
I don't suppose there would be a document or help file you could point me to that shows how you constructed that BQL statement? I have multiple questions on things I never saw before, such as the "from" clause using "driver:PingHealth", what is "toString" (it would seem to be a function, but in this case I can't tell if it's a field or not because it doesn't have any arguments like a function would), and how did you know to use "health" as where clause?????????
My previous experience with SQL I would construct a query and use a "select *" and then I would get all the fields in the table and I would just throw out what I didn't want, but BQL doesn't let you do this, or at least not that I have figured out how to do it.
Again, any help is appreciated!
-
Originally Posted by
VAEngineer
Thank you for this post! If I could bug both "letsTryThis" and "lwarren" for a bit more info I would really appreciate it.
lwarren:
I don't suppose there would be a document or help file you could point me to that shows how you constructed that BQL statement? I have multiple questions on things I never saw before, such as the "from" clause using "driver:PingHealth", what is "toString" (it would seem to be a function, but in this case I can't tell if it's a field or not because it doesn't have any arguments like a function would), and how did you know to use "health" as where clause?????????
My previous experience with SQL I would construct a query and use a "select *" and then I would get all the fields in the table and I would just throw out what I didn't want, but BQL doesn't let you do this, or at least not that I have figured out how to do it.
Again, any help is appreciated!
I am BQL dummy. If it is not something simple I have to play around with it. I went and looked at the slot sheet of a controller to find Health slot type and then started from there.
Go Rangers!
-
Also, if you look at BQL in the help there are a lot of examples.
Go Rangers!
-
Originally Posted by
VAEngineer
letsTryThis:
I looked at the help file for the module you gave above and was wondering how you went from the that help file to knowing to use %health.getLastOkTime%. Specifically how did you know "health part??? I mean I know method part to use the "getLastOkTime", but how did you connect the "BPingHealth" part the "health.METHOD"????? Also, how did you know it would be usable in a BFormat string and not as an argument in a BQL query?
I tried doing a search in the help files on the string %health.getLastOkTime% and it gave me the module you indicated in the path above and it also gave me a result of the BPingHealth.java file, however, that java file does not exist anywhere on my installation that I can find. I even searched the AX directories and it wasn't there.
So like I mentioned there was a LOT of trial and error. Adding in the health part of the command was the hardest part for me to get. When just using getLastOkTime you get an obvious failed attempt at data collection in the report service. Therefore I dont really have anything that would specifically tell you why you need that there. Though trying to use some critical thinking, I would think that its almost similar to the %parent.parent% aspect. In the property sheet of the device/network the section that you can find the Last Ok Time is in the drop down of Health. Seems to me that you are first calling for the location of the data "%health." and then using the BFormat command getLastOkTime%.
In regards to knowing its usable in BFormat, I cant really say that I knew for sure either. Ive always used BFormat text for creating my report pages. I couldnt even tell you how to use Bql with report building. But the location of these doc files is inside of the baja folder of certain modules. That was enough for me to give it a shot. Though like anything else you can try and accomplish something for a few hours and end up never getting there because its just not possible. I think there was a bit of luck involved. Im only going into my 3rd year of doing controls so there isnt a lot of experience to draw from.
THOUGH something Ive attempted to do and still want to figure out is how to set up a command for a PING to each controller on a network all at once. Currently all I know is to do the pings all individually. I asked Vern from MOV if there was a PingAll feature and he said there wasnt that he knew of. My next goal is to figure out how to do a custom program or use some service that can use the BFormat command doPing which is what workbench uses.
-
I believe if you right click on the driver and select actions>ping it will start pinging all the controllers under that driver.
Go Rangers!
-
Originally Posted by
lwarren
I believe if you right click on the driver and select actions>ping it will start pinging all the controllers under that driver.
Ive attempted that before to no avail. That was Vern's suggestion too but it didnt work until I did it for the specific controller.
Which makes sense considering the command is doPing. It seems to me that its just doing a ping for the specific health slot of the device/network.
I was hoping there was a way to use something like the program service to search all the controllers I want to, then initiate the doPing command for the Health slot of each device searched.
-
Originally Posted by
lwarren
I am BQL dummy. If it is not something simple I have to play around with it. I went and looked at the slot sheet of a controller to find Health slot type and then started from there.
OK, now that's a clue I needed! BTW - in playing with this this morning I always had problems where I could create a query that would return results, but not as a "BQLGrid" only as a "collection table". That's the case with your query, I can only get a collection table to appear (by hitting the right arrow in the BQLGrid property sheet). I just found out that if I copy and paste the working query that returns a collection table into the "ord" slot of a bound table and then choose the view of "collection table" I can use it in a report!!!! I can't beleive it's taken me 2 years to figure that out!!!! But know that I know it, it will be extremely helpful, especially now that I know that the slot sheet will show me what driver to include in the BQL query! And BTW - if you are only caring about a collection table, than you can use a "select *" and it will return all the available fields so you know what to call them!