B4J Question ABMaterial web app - lookup table

DarkoT

Active Member
Licensed User
Guys, I need your suggestion/help...

I builded web app in B4J based on ABMaterial framework. Everything work fine, but users are "users" and want to have different solution for data searching... I already implemented ABMInput box with AutoComplete logic... But - here is posible to search only on one field...
How to solve this problem, when users nedd to input delivery note number, but want to search delivery notes based on customer name, delivery date, delivery description, ...? Should I build a ModalSheet and work with this modalsheet as lookup table? (I know how to read data from mysql db over rdc)
What will be best (and easy to implement) solution for clasical lookup on web app...

Thank you...
Darko
 

DarkoT

Active Member
Licensed User
Guys, I need your suggestion/help...

I builded web app in B4J based on ABMaterial framework. Everything work fine, but users are "users" and want to have different solution for data searching... I already implemented ABMInput box with AutoComplete logic... But - here is posible to search only on one field...
How to solve this problem, when users nedd to input delivery note number, but want to search delivery notes based on customer name, delivery date, delivery description, ...? Should I build a ModalSheet and work with this modalsheet as lookup table? (I know how to read data from mysql db over rdc)
What will be best (and easy to implement) solution for clasical lookup on web app...

Thank you...
Darko
Hi to all...

Any suggestion here?! Please, I will need some input - how to start development for web app which need to contain a look up...

Tnx...
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
but want to search delivery notes based on customer name, delivery date, delivery description
Not directly related to ABM, but more of a MySQL / programming logic issue (complex filter).

Yes, you could have a "search" button (label or whatever) which brings up a modal sheet.
On this sheet you could display the delivery date range (default to last "30 - 10 - whatever" days) - and an option to change it with datepicker...
Use a combo or input for "customer name" - yet this could be many and needs to be reduced (name begins with "c").
Now the "delivery notes" is what to look for (notetext).

Example hacked MySQL select statement (not correct syntax but you get the hint):
SELECT * FROM table WHERE deliverydate BETWEEN (?, ?) AND custname = ? AND notes CONTAINS ?, Array of Object(startdate, enddate, custname, notetext)

Press SEARCH button on modal sheet (or CANCEL).
Depending on what what fields were used (ie. search all customers because this option was not defined to a specific one), use the appropriate RDC call (could be many you create).
Return results and put into another (or same) ABMTable.....

It's all up to you how this / these complex filter(s) is constructed and implemented...

Thanks
 
Upvote 0

DarkoT

Active Member
Licensed User
Hi,
Not directly related to ABM, but more of a MySQL / programming logic issue (complex filter).

Yes, you could have a "search" button (label or whatever) which brings up a modal sheet.
On this sheet you could display the delivery date range (default to last "30 - 10 - whatever" days) - and an option to change it with datepicker...
Use a combo or input for "customer name" - yet this could be many and needs to be reduced (name begins with "c").
Now the "delivery notes" is what to look for (notetext).

Example hacked MySQL select statement (not correct syntax but you get the hint):
SELECT * FROM table WHERE deliverydate BETWEEN (?, ?) AND custname = ? AND notes CONTAINS ?, Array of Object(startdate, enddate, custname, notetext)

Press SEARCH button on modal sheet (or CANCEL).
Depending on what what fields were used (ie. search all customers because this option was not defined to a specific one), use the appropriate RDC call (could be many you create).
Return results and put into another (or same) ABMTable.....

It's all up to you how this / these complex filter(s) is constructed and implemented...

Thanks
I know how to handle the problem in MySql (I’m expert on MS SQL server, and I know the similar logic in MySql). More is the question related which object should I use for look-up logic... And from your description is now clear, that you are suggesting to build a modal sheet for looking the records...


Thanx, maybe I’m now sure to which direction should I think...

Regards, Darko
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
(I’m expert on MS SQL server, and I know the similar logic in MySql)
GREAT! I am not an expert on anything - expect breathing and heart beating (for now). Your input will be most valuable around here. I and many others struggle with this.
 
Upvote 0

DarkoT

Active Member
Licensed User
GREAT! I am not an expert on anything - expect breathing and heart beating (for now). Your input will be most valuable around here. I and many others struggle with this.
No problem... When you need something, just let me know... If I can help - no problem...

Regards, Darko
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
We make use of the NavigationBars ExtraContent on top for the 'filter'.

1589794457418.png


Snippets:
B4X:
' on Build (it acts just like a container)
    Page.NavigationBar.InitializeExtraContent("extracontent", True, "onetwolight")
   
    ' text search
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,5,"")
    ' date
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,5,"")
    ' reg
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,5,"")
    ' executor, group, item
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,3,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,3,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,3,"")
    ' switches
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,3,2,1,9,10,3,8,20,0,0,"").AddCellsOSMP(1,3,2,1,9,10,3,8,20,0,0,"").AddCellsOSMP(1,3,2,1,9,10,3,8,20,0,0,"")
   
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,8,0,"").AddCells12(1,"")
    Page.NavigationBar.ExtraContent.BuildGrid

B4X:
' on connect adding the components
    Page.NavigationBar.ExtraContent.EventHandler = Me
   
    Dim rowIndex As Int = 0
       
    rowIndex = rowIndex + 1
    Dim btnTextSearch As ABMButton
    Page.NavigationBar.ExtraContent.Row(rowIndex).Visibility = ABM.VISIBILITY_HIDE_ALL
    btnTextSearch.InitializeFloating(Page, Name & "btnTextSearch", "fa fa-search", "onetwo")
    Page.NavigationBar.ExtraContent.Cell(rowIndex,1).AddComponent(btnTextSearch)
   
    Dim inpTextSearch As ABMInput
    inpTextSearch.Initialize(Page, Name & "inpTextSearch", ABM.INPUT_TEXT, "", False, "simplereset")
    inpTextSearch.PlaceHolderText = ""
    Page.NavigationBar.ExtraContent.Cell(rowIndex,2).AddComponent(inpTextSearch)
       
    rowIndex = rowIndex + 1
    Page.NavigationBar.ExtraContent.Row(rowIndex).Visibility = ABM.VISIBILITY_HIDE_ALL
    Dim btnPeriod As ABMButton
    btnPeriod.InitializeFloating(Page, Name & "btnPeriod", "", "onetwo")
    Page.NavigationBar.ExtraContent.Cell(rowIndex,1).AddComponent(btnPeriod)
   
   ...

to open en close the extra content
B4X:
page.NavigationBar.CloseExtraContent
page.NavigationBar.OpenExtraContent

more info here: https://www.b4x.com/android/forum/t...nd-the-navigation-top-bar-3-02.77582/#content

alwaysbusy
 
Upvote 0

DarkoT

Active Member
Licensed User
We make use of the NavigationBars ExtraContent on top for the 'filter'.

View attachment 94295

Snippets:
B4X:
' on Build (it acts just like a container)
    Page.NavigationBar.InitializeExtraContent("extracontent", True, "onetwolight")
  
    ' text search
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,5,"")
    ' date
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,5,"")
    ' reg
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,5,"")
    ' executor, group, item
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,3,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,3,"").AddCellsOSMP(1,0,0,0,3,2,1,8,0,0,0,"ccenter").AddCellsOS(1,0,0,0,9,10,3,"")
    ' switches
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,0,0,"").AddCellsOSMP(1,3,2,1,9,10,3,8,20,0,0,"").AddCellsOSMP(1,3,2,1,9,10,3,8,20,0,0,"").AddCellsOSMP(1,3,2,1,9,10,3,8,20,0,0,"")
  
    Page.NavigationBar.ExtraContent.AddRowsM(1, False,8,0,"").AddCells12(1,"")
    Page.NavigationBar.ExtraContent.BuildGrid

B4X:
' on connect adding the components
    Page.NavigationBar.ExtraContent.EventHandler = Me
  
    Dim rowIndex As Int = 0
      
    rowIndex = rowIndex + 1
    Dim btnTextSearch As ABMButton
    Page.NavigationBar.ExtraContent.Row(rowIndex).Visibility = ABM.VISIBILITY_HIDE_ALL
    btnTextSearch.InitializeFloating(Page, Name & "btnTextSearch", "fa fa-search", "onetwo")
    Page.NavigationBar.ExtraContent.Cell(rowIndex,1).AddComponent(btnTextSearch)
  
    Dim inpTextSearch As ABMInput
    inpTextSearch.Initialize(Page, Name & "inpTextSearch", ABM.INPUT_TEXT, "", False, "simplereset")
    inpTextSearch.PlaceHolderText = ""
    Page.NavigationBar.ExtraContent.Cell(rowIndex,2).AddComponent(inpTextSearch)
      
    rowIndex = rowIndex + 1
    Page.NavigationBar.ExtraContent.Row(rowIndex).Visibility = ABM.VISIBILITY_HIDE_ALL
    Dim btnPeriod As ABMButton
    btnPeriod.InitializeFloating(Page, Name & "btnPeriod", "", "onetwo")
    Page.NavigationBar.ExtraContent.Cell(rowIndex,1).AddComponent(btnPeriod)
  
   ...

to open en close the extra content
B4X:
page.NavigationBar.CloseExtraContent
page.NavigationBar.OpenExtraContent

more info here: https://www.b4x.com/android/forum/t...nd-the-navigation-top-bar-3-02.77582/#content

alwaysbusy
You means - something like this?

1589795370914.png


This is already made; there was just my question - which way is best, to show data from some look-up table and to give users possibility to search on different data (not just name of material):


1589795504625.png


I think - best way is to build modal sheet...
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
which way is best, to show data from some look-up table and to give users possibility to search on different data
I don't think you are using the ExtraContent of the NavigationBar no? The difference is it stays on top (your table scrolls under it), can easily be hidden or shown etc... Have a look at the video in the link in my post.
 
Upvote 0

DarkoT

Active Member
Licensed User
I don't think you are using the ExtraContent of the NavigationBar no? The difference is it stays on top (your table scrolls under it), can easily be hidden or shown etc... Have a look at the video in the link in my post.
Correct... I'm using clasic NavigationBar with ABMInput... Okey, good input... I will use it to ExtraContent...

Thank you...

Darko
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Please post what you come up with (pics and code). This is valuable stuff.
Everyone's needs are different but a starting point (example) shaves hours off the dev time.
For me, it seems I spend more time researching than actually coding / implementing.
But when I find a gem, I copy and paste - modify as required. My middle name is Harris - which translates into any language as "lazy"...
 
Upvote 0

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
Please post what you come up with (pics and code). This is valuable stuff.
Everyone's needs are different but a starting point (example) shaves hours off the dev time.
For me, it seems I spend more time researching than actually coding / implementing.
But when I find a gem, I copy and paste - modify as required. My middle name is Harris - which translates into any language as "lazy"...
Actually, in Greek, it translates as "grace".:)
 
Upvote 0
Top