Add extra database field to blogengine.net - blogengine.net

I have added an extra field in the Pages table that I call VirtualPath. This is so that I can have virtual paths to my pages.
In the code I add "VirtualPath" as an extra parameter to the CommandText which means that there will be 14 elements to pick from the database. I duplicate the routine to grep the actual value:
if (!rdr.isDbNull(14))
{
page.VirtualPath = rdr.GetString(14);
}
The problem is that the it never enters the if-statement. When I step the code and I arrive at the !rdr.isDbNull(14)-row and do step-in I see that the DBHelper makes a dispose somehow...
My question is: Is there somewhere else I have to do a change to add an extra parameter like this? Or, does anyone have an idea of what I do wrong. And yes, I have entered values to the VirtualPath-field in the database so it should not be null.

If there are 14 elements to pick from the table, the 14th should be referenced by index 13 (zero-based index).

Related

BIRT Repeating only part of a header

What I am currently trying to do in BIRT 4.5 is repeat only a specific part of my tables header. However when I set it to repeat the header it always repeats the entire header.
Is there a way to only repeat a specific part of the header?
In my example - there is two headers, the "table name" and the "column headings". I only want the column headings to repeat. I have a feeling its likely going to be a scripted fix, but have no idea where to go to start it.
this might get tricky because headers can be repeated for groups but also for pagebreaks.
Not the most fancy, but you should get something working by defining a global variable on the page script
var headerCount = 0;
Then select an element in the header, open the onPrepare script and have it increment the counter:
headerCount = headerCount + 1;
with this information, you can make true/false statements in the visibility property.
Each object has onPrepare, onCreate, onRender and onPagebreak scripts. Not sure what the exact difference, so you have to experiment a bit with this. (because when an element should increase the counter, but is not rendered due to the visibility clause, you can get unexpected results.)
Good luck!

Access to iterated controls in repeated sections in Orbeon

When setting repeated content in a section in Orbeon each control is repeated and the their names are the same. How do I access the the control from the first, second...etc instance of a control from each iterated section? I'm thinking along the lines of $control-name[instance#] or something similair.
The following works, given this form:
$name[2]: return the second value
string-join($name, ', '): join all values with commas
count($name): return the number of values
See also the relevant documentation.
To access this value in "bind" section, you can use a relative path , like ../name=''.
TO access this value in "body" section, then you can use context()/../name.
If you are trying to make anything different, be more specific and this answer can be edited to be according to what you want.

App Inventor TinyWebDB List Problems

I got a problem using the TinyWebDB in App Inventor 2. Here's a Screenshot of the blockcode.
The goal of this Screen is to store a list(array) of images and later query them with a button but my problem starts already earlier. First there is a variable initialized called fotoList and declared as an empty list.
When this Screen initializes (left block) I store the empty fotoList under the tag FotoListTag. Then if the image under the tag "SteckbriefFoto" is not in this list -> getValue with tag "FotoListTag". Then he jumps into the block on the right and adds the photo .. other stuff not important .. at the end I store the list again in the TinyWebDB (and also in the TinyDB) with the tag "FotoListTag". Then it goes back to the block on the left where at the end I want to set an image.picture to the photo I stored in variable fotoList.
When I compile the code there is an error opening the page that says
Select list item: List index too large
Select list item: Attempt to get item number 1 of a list of length 0:()
I just don't get the problem with this code and i hope someone can help me.
For lists, valueIfTagNotThere should be create empty list instead of an empty string
On first run of your app, TinyDB is empty, which means, for tag = FotoListTag you get no value back, therefore this should be an empty list in the beginning.
Later you are trying to select the first item from the list (zahl is 1). As you know, the list is empty in the beginning, so probably you should add an if statement to check, if the list is not empty and only then select the first item... same for tag = Schriftlist.
You also have a timing issue. in Screen.Initialize you are trying to get a value from TinyWebDB. This is an asynchronous call, you get the result back in TinyWebDB.GotResult event and this takes a little bit (let's say 500 milliseconds), but meanwhile the complete blocks of the Screen.Initialize event will be executed. Probably you are expecting, that meanwhile tag = FotolistTag is not empty anymore, but this is not the case.

IsEmpty or IsNull or IsNothing?

Can someone help me determine which I should be using?
Here is the situation - I am pulling a value from a column in the Data Table. If there is anything in that column, I set the data to a variable and take an action. If the column is blank, I want to skip that.
I am confused as to which IsWHATEVER statement would be best. For Example:
If IsEmpty(Datatable.Value("M4","Data_Entry"))=False Then
OR
If IsNull(Datatable.Value("M4","Data_Entry"))=False Then
OR
If IsNothing(Datatable.Value("M4","Data_Entry"))=False Then
Suggestions?
I've just tried all of your options and found this to be the most correct:
If (DataTable.Value("M4","Global") <> "") Then
Your original options will not work on QTP Datatables as these are for uninitialised objects or variables. However, in QTP as soon as you create a parameter in the Datatable the first value gets initialised as blank (not to be confused with empty).
I agree with shreyansp.. The 3 options are for variables and objects
You could also use the below expression
If len(trim(DataTable.Value("M4","Global"))>0 Then
'Do code here
End If

Character length in single line edit filter PowerBuilder

My SQL code gives me over 10 000 rows, each containing client id, name, address and so forth. In my PowerBuilder 10.5 window I've set my DataWindow in which I'm retrieving my SQL code using id as retrieve argument. I have a Single line Edit (sle_id) in which the user can write an id and search by it. What I've figured out is that all of my clients have id's length of 8 characters and starting with either "46XXXXXXXX" or "7052XXXX". So to optimize my retrieve time I want to write a code in the clicked event of my "Start" button that is located in PowerBuilder window that would first check if the id starts with one of does two options: "46..." or "7052...". I assume I'd need to use length of the characters? For example, this is what I'd want...
IF sle_id.text STARTS with 46 or 7052 THEN retrieve
ELSE MessageBox ("INFO", "Your id must have begin with either 32 or 7052")
END IF;
Of course, I need something better then "Starts with". Much oblige for all the help!
there are some string functions in powerbuilder. I think you need this:
If( left(sle_id.text, 2) = "46" or left(sle_id.text, 4) = "7052" ) then
Best Regards
Gábor
I think you're trying to solve the wrong problem. Your database should have an index on client id. If the client id is unique use a unique index.

Resources