CMS Development

joan1
Contributor

Hubdb row field in design manager

SOLVE

Hi everyone,

 

I'm stuck on the way to use this field.  I set it up on the design manager and expected a number value on frontend but I get the table data in some json encoded value.

To explain the context and the result here is the set up I made:

I have some value define in hubdb in one row with different kind of number. 
On this hubdb I will say I have a column total and another column total_currency.

 

What I try to acheve is to use a module with different block like that  <Text field> <hubdb row column total> <hubdb row column currency> < rich text field>

 

on hubl part I have:  {{ module.hubdb_total }}

on the field parameters:

column to fetch and column for choice label:  

total + total_currency

format of choice label: %0 %1

and default row value I chose the value I set up so in the example 200 bn $

 

Now on the front end I get the json, I have no idea how to show the value instead of the json:

total 554472... {hs_id=554472..., hs_child_table_id=0, hs_updated_at=1631861664058, hs_created_at=1631861311310, total=200 }

So my question at the end is how I should put the code in the hubl part to show only the value.

 

Thanks for the help you can provide.

 

Kind regards.

Joan 

0 Upvotes
3 Accepted solutions
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE
Could you try {{module.hubdb_aum.aum}} ?


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


View solution in original post

0 Upvotes
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE
That is odd. What do you get if you output {{module.hubdb_aum.hs_id}} ? Does that show a value?


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


View solution in original post

0 Upvotes
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE

Guess the HubDB row field returns an array, not sure why, because you select a single row from a HubDB using this field.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


View solution in original post

19 Replies 19
JGauerke
Participant

Hubdb row field in design manager

SOLVE

I think you need to pull it out of the columns array. Add ".columns". So {{module.hubdb_aum.columns.aum}}.

0 Upvotes
natsumimori
Community Manager
Community Manager

Hubdb row field in design manager

SOLVE

@Teun Thank you so much for your inputs here!!

Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE

Happy to help!



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE

Guess the HubDB row field returns an array, not sure why, because you select a single row from a HubDB using this field.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


joan1
Contributor

Hubdb row field in design manager

SOLVE

Yes, at the end by using the for loop it work so it's fine so I guess we can closed the topic but if I find the reason / solution to avoid it I will let you know.

 

Thanks for the help.

Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE

@joan1 Try the following, saves you the loop:

{{module.hubdb_aum[0].aum}}


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE

Hi @joan1 ,

 

What is your field name? Can you make the screenshot a bit larger?

I see that you now retrieve the 'aum' property as well, what other property are you missing?



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


joan1
Contributor

Hubdb row field in design manager

SOLVE

Hi @Teun , here is my screen of what I get a bit larger

joan1_0-1632273782871.png

The problem is not I don't get it, this screen is the front end, that's what I get with {{module.hubdb_aum||pprint}} but what I would like to show is only the 280 without the tableId and the following json.

 

Regards.

Joan

 

0 Upvotes
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE
Could you try {{module.hubdb_aum.aum}} ?


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
joan1
Contributor

Hubdb row field in design manager

SOLVE

I tried before and tried again now, if I do that, I don't get the json, but I don't get the value, it just become blank

0 Upvotes
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE
That is odd. What do you get if you output {{module.hubdb_aum.hs_id}} ? Does that show a value?


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
joan1
Contributor

Hubdb row field in design manager

SOLVE

Here are the different screenshot with what I get:

joan1_0-1632294162194.png

 

the front end editor:

joan1_1-1632294445068.png

and the the page itself:

joan1_2-1632294510103.png

 

0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE
Could you also share your code to display this on the front-end?
What happens if you use {{module.hudb_aum['aum']}} ? The docs describe multiple methods to retrieve a column value: https://developers.hubspot.com/docs/cms/data/hubdb


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
joan1
Contributor

Hubdb row field in design manager

SOLVE

Yes, 
I found a solution to show it but it's a bit tricky I think,
with this code it work:

joan1_0-1632295891328.png

so I get it with the for loup.
the module itself show nothing and on the content editor, it's made like that:

joan1_1-1632296207952.png

I also tried {{module.hudb_aum['aum']}}  and same, that return empty value

0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE

Hi @joan1 ,

 

This suggests that you retrieved multiple rows with your function. Are you 100% sure that you did not use the HubDB_table field? If you click on the select, do you see 'Select a HubDB row' or do you see 'Select a HubDB table' ?



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


joan1
Contributor

Hubdb row field in design manager

SOLVE

I choose hubdRow field, I share you a screenshot about this:

joan1_0-1632296734746.png

but yes I agree the way it work looks like it try to retrieve multiple rows.

0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Hubdb row field in design manager

SOLVE

Hi @joan1  ,

 

What field type did you use to select the HubDB row in your module?
If you used the type hubdbrow, you should also set what columns you want to fetch:
Schermafbeelding 2021-09-21 om 08.38.47.png
If your field name is hubdb_total, you can use {{module.hubdb_total|pprint}} to check the contents. But based on the output, it seems as if you used HubDB table field instead. Could you doublecheck if you chose the right field type?



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


joan1
Contributor

Hubdb row field in design manager

SOLVE

Hi @Teun ,

 

thanks for your answer.
I checked and I use Hubdbrow field: 

joan1_2-1632208358704.png

 


I changed a bit the naming but here is my screenshot of my current settings:

joan1_0-1632208021425.png

I tried to add the pprint and then in the front end I still got that: 

joan1_1-1632208272626.png

 

Regards.

Joan

 

natsumimori
Community Manager
Community Manager

Hubdb row field in design manager

SOLVE

Thank you for your post @joan1 !

 

@miljkovicmisa - I'm wondering if you could weigh in here, would you mind sharing your advice for Joan?